Skip to Content
FrameworksOpenAI Agents SDK + Curate-Me

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 uses the OpenAI Responses API (/v1/responses) for its newer reasoning models. The gateway’s mock smoke test exercises /v1/openai/v1/responses to keep this surface covered.

Supported versions

LibraryTested range
openai-agents>=0.3.0,<0.5.0
openai (SDK)>=1.30.0,<2.0.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 traceparent header (W3C) on your outer call if you want the Agents SDK trace to link to the gateway trace.