OpenAI Agents SDK
The OpenAI Agents SDK uses an AsyncOpenAI client under the hood.
Override its base_url to send all agent traffic through Curate-Me.
Minimal example
import asyncio, os
from openai import AsyncOpenAI
from agents import Agent, Runner
client = AsyncOpenAI(
base_url=f"{os.environ.get('CURATE_ME_GATEWAY_URL', 'https://api.curate-me.ai')}/v1/openai",
api_key=os.environ["CM_API_KEY"],
default_headers={"X-CM-API-Key": os.environ["CM_API_KEY"]},
)
agent = Agent(
name="Researcher",
instructions="You are a concise market researcher.",
model="gpt-4.1",
)
async def main():
out = await Runner.run(agent, "Summarize the AI gateway category in 2 sentences.")
print(out.final_output)
asyncio.run(main())Full example at
examples/integrations/openai-agents/basic_agent.py.
Responses API
The Agents SDK can use the OpenAI Responses API (/v1/responses) for
its newer reasoning models.
Status: not yet available. The production gateway does not proxy the Responses API. Only the OpenAI Chat Completions (
/v1/openai/chat/completions), Embeddings (/v1/openai/embeddings), and Models (/v1/openai/models) endpoints are served — a Responses-API call againstapi.curate-me.aireturns404. The Responses surface is currently validated only against the docs mock gateway (scripts/docs/mock-gateway/server.py).
Until production support lands, configure the Agents SDK to use Chat
Completions when routing through Curate-Me (for example, select a
ChatCompletions model setting rather than the default Responses model).
Confirm the exact escape-hatch flag against your installed
openai-agents version.
Supported versions
| Library | Tested range |
|---|---|
openai-agents | >=0.2.0 |
openai (SDK) | >=1.60.0 |
Known limitations
- Handoffs: handoffs to other agents work as long as each target
agent’s LLM also has the gateway
base_url. The gateway does NOT intercept handoff routing — that runs inside the SDK. - Tool execution: function tools execute in your process. The LLM call that selects the tool is governed; the tool body’s network calls are not (use the Observer SDK if you want span-level cost on tool side-effects).
- Tracing: pass a
traceparentheader (W3C) on your outer call if you want the Agents SDK trace to link to the gateway trace.