Orq MCP is live: Use natural language to interrogate traces, spot regressions, and experiment your way to optimal AI configurations. Available in Claude Desktop, Claude Code, Cursor, and more. Start now →
OpenAI Agents SDK enables powerful AI-driven automation through structured conversations and tool calling. Connecting the Agents SDK to Orq.ai’s AI Gateway transforms experimental agents into production-ready systems with enterprise-grade capabilities.
Configure OpenAI Agents SDK to use Orq.ai’s AI Gateway by setting a custom AsyncOpenAI client:
Python
from openai import AsyncOpenAIfrom agents import set_default_openai_client, set_tracing_disabledimport os# Configure OpenAI client with Orq.ai AI Gatewayclient = AsyncOpenAI( api_key=os.getenv("ORQ_API_KEY"), base_url="https://api.orq.ai/v3/router")# Disable the SDK's built-in OpenAI tracing exporter for gateway-only useset_tracing_disabled(True)# Set as default client for all agentsset_default_openai_client(client)
The OpenAI Agents SDK includes built-in tracing that exports to OpenAI’s hosted Traces dashboard by default. When you use Orq.ai’s AI Gateway with ORQ_API_KEY and do not configure OpenAI tracing credentials, the SDK can print No API key provided for OpenAI tracing exporter. Exports will be skipped.
Do not set OPENAI_API_KEY only to silence this warning. That sends SDK traces to OpenAI’s dashboard instead of Orq.ai. Disable the SDK’s built-in OpenAI tracing for gateway-only use when agent traces in Orq.ai are not needed.
export OPENAI_AGENTS_DISABLE_TRACING=1
Or disable it in code:
import { setTracingDisabled } from "@openai/agents";setTracingDisabled(true);
OpenAI Agents can use tools while routing through Orq.ai:
Python
from openai import AsyncOpenAIfrom agents import Agent, Runner, set_default_openai_client, set_tracing_disabled, function_toolimport os# Configure clientclient = AsyncOpenAI( api_key=os.getenv("ORQ_API_KEY"), base_url="https://api.orq.ai/v3/router")set_tracing_disabled(True)set_default_openai_client(client)# Define a tool using the @function_tool decorator@function_tooldef get_weather(location: str) -> str: """Get the current weather for a location.""" return f"The weather in {location} is sunny and 72°F"# Create agent with toolsagent = Agent( name="Weather Assistant", instructions="You are a weather assistant. Use the get_weather function to provide weather information.", tools=[get_weather])# Run agent with tool accessresult = Runner.run_sync(agent, "What's the weather in San Francisco?")print(result.final_output)
With Orq.ai, any supported model from 20+ providers can be used:
Python
from openai import AsyncOpenAIfrom agents import Agent, Runner, set_default_openai_client, set_tracing_disabledimport os# Configure clientclient = AsyncOpenAI( api_key=os.getenv("ORQ_API_KEY"), base_url="https://api.orq.ai/v3/router")set_tracing_disabled(True)set_default_openai_client(client)# Use Claudeclaude_agent = Agent( name="Claude Assistant", model="anthropic/claude-sonnet-4-6", instructions="You are a helpful assistant.")# Use Geminigemini_agent = Agent( name="Gemini Assistant", model="google-ai/gemini-2.5-flash", instructions="You are a helpful assistant.")# Use any other modelgroq_agent = Agent( name="Groq Assistant", model="groq/llama-3.3-70b-versatile", instructions="You are a helpful assistant.")# Run with different modelsresult = Runner.run_sync(claude_agent, "Explain machine learning")print(result.final_output)