The OpenAI Agents SDK is OpenAI's official agent framework, released in 2025 as the production-grade successor to the Assistants API. Python and TypeScript SDKs, both open source. Built around five primitives: Agents, Handoffs, Tools, Guardrails, and Tracing. Native MCP support, native function-calling, native built-in tracing dashboard on the OpenAI Platform. The default for production agents on GPT, and the cleanest path from prototype to scaled deployment for teams already on OpenAI infrastructure.
The OpenAI Agents SDK (openai-agents on PyPI, @openai/agents on npm) is OpenAI's official agent framework. It launched in 2025 as the successor to the older Assistants API, addressing the production gaps that platform had: opaque execution, limited debugging, no clean handoff pattern between agents, no first-party MCP integration. The new SDK is open source, available in Python and TypeScript with a third-party Go port, and ships under a permissive licence.
The thesis: OpenAI knows how their models behave best. The SDK encodes those production patterns — structured handoffs, declarative guardrails, automatic tracing, MCP-first tool integration — rather than leaving teams to invent them. For agents that run on GPT-4.x, GPT-5, or the o-series reasoning models, the Agents SDK is the framework that's tested against the model behaviour you actually get.
Distribution: the SDK works against the OpenAI Platform, Azure OpenAI Service, and any OpenAI-compatible endpoint (Ollama's localhost:11434, OpenRouter, vLLM-served open-weights models). That last point matters — despite the name, the SDK is not strictly OpenAI-only; it's optimised for OpenAI but works with any compatible model API.
Two OpenAI things sound similar. The openai SDK (Python / TS) is the basic API client — chat completions, tool use, streaming. The openai-agents SDK is the higher-level agent framework — this leaf. They're separate packages. The agent SDK depends on the basic SDK under the hood, but adds the five primitives and the tracing infrastructure. If you read about the "OpenAI Agents SDK" or "openai-agents," that's the framework this leaf covers.
Each primitive solves a specific production-agent problem. Together they cover the day-to-day shape of building agents that need to delegate to specialists, run safely, and produce auditable execution traces — without bringing in heavier framework abstractions.
The unit of work. Has a model, instructions, tools, and optionally sub-agents to hand off to. Created via Agent(name, instructions, model, tools).
Structured way for one agent to delegate to another mid-conversation. The receiving agent inherits context. Solves the "how do I escalate from triage to specialist" question cleanly.
Plain functions decorated with @function_tool. The SDK introspects signatures for JSON-Schema. MCP servers, hosted OpenAI tools (web search, file search, computer use), and external APIs all integrate.
Declarative input/output validators that run alongside the agent. Catch policy violations, flag PII, enforce structured-output schemas. Halt execution or trigger fallback behaviour.
Automatic. Every agent run produces a structured trace visible in the OpenAI Platform dashboard. Spans for handoffs, tool calls, LLM calls, guardrail evaluations. The most polished out-of-the-box observability of any framework.
Persistent conversation history with automatic context management. The SDK handles trimming and continuation; you pass session_id and it works.
The minimal Agent in Python:
# pip install openai-agents from agents import Agent, Runner agent = Agent( name="Assistant", instructions="You help users analyse JSE market data.", model="gpt-5", ) result = await Runner.run(agent, "What's been driving SA bond yields this quarter?") print(result.final_output)
Tools as Python functions. Decorate; the SDK does the rest:
from agents import Agent, function_tool @function_tool def get_market_data(symbol: str, days: int = 30) -> dict: """Fetch recent market data for a JSE-listed symbol.""" return fetch_from_jse_api(symbol, days) agent = Agent( name="JSE Analyst", model="gpt-5", tools=[get_market_data], )
Handoffs — the OpenAI SDK's signature primitive. A triage agent routes to specialist agents based on the user's intent:
from agents import Agent, handoff billing = Agent(name="Billing", instructions="Handle billing-related questions.") technical = Agent(name="Technical", instructions="Handle technical issues.") triage = Agent( name="Triage", instructions="Route to the right specialist.", handoffs=[billing, technical], # SDK creates handoff tools automatically )
Guardrails as declarative validators. The SDK halts the agent if a guardrail trips:
from agents import Agent, GuardrailFunctionOutput, input_guardrail @input_guardrail async def no_pii(ctx, agent, input_text): has_pii = await classify_pii(input_text) return GuardrailFunctionOutput( output_info={"has_pii": has_pii}, tripwire_triggered=has_pii, ) agent = Agent(name="Public Assistant", model="gpt-5", input_guardrails=[no_pii])
Every agent run is automatically traced and visible in the OpenAI Platform dashboard at platform.openai.com/traces. Spans for every LLM call, every tool call, every handoff, every guardrail evaluation. You don't wire it up — it's on by default. For production debugging this is a meaningful advantage over LangGraph (where LangSmith is paid) and Anthropic SDK (where you wire up OTel yourself).
The Agents SDK lives inside OpenAI's broader platform: the model API, the Tracing dashboard, the hosted tools (web search, file search, computer use, code interpreter), and the deployment surfaces. For SA enterprise, Azure OpenAI is the parallel surface — same models, regional residency options, Microsoft's enterprise contracting model.
Python and TS SDKs. Open source. Self-host anywhere — Lambda, Cloud Run, Fly, your laptop, Cloudflare Workers via Node-compat.
Hosts the API + Tracing + Evals + Files. Free tier; usage-based billing. The default deployment surface for SDK-built agents.
Microsoft's parallel hosting. Same models, enterprise contracting, regional availability including SA via South Africa North. The path for SA enterprise that needs Microsoft / Azure compliance posture.
OpenAI hosts a small set of "first-party" tools the SDK exposes. Web search is best-known; file search is a managed RAG layer; computer use is OpenAI's vision-driven UI control.
OpenAI's voice / audio agents use the Realtime API — that's a separate WebSocket-based interface, not part of the Agents SDK. For text-and-tool agents, this SDK is the path. For bidirectional voice, Realtime API is. Some teams build hybrid systems where the Realtime endpoint terminates user voice and dispatches to Agents-SDK-managed text agents for actual reasoning.
The OpenAI SDK and Anthropic SDK are mirror images: each is the first-party framework for one frontier vendor. Same shape (tool-use loop + sub-agent delegation + MCP) but different vendor alignment. LangGraph and ADK are the cross-vendor alternatives. Choose based on which model and cloud you're already on.
| Dimension | OpenAI Agents SDK | Anthropic Agent SDK |
|---|---|---|
| Default model | GPT + o-series (works against any OpenAI-compatible API) | Claude-only |
| Sub-agent pattern | Handoffs (peer transfer) | Task tool (parent spawns) |
| Built-in tracing | OpenAI Platform dashboard, on by default | OTel + Anthropic console |
| Guardrails | First-class primitive | Build your own with hooks |
| Reasoning model integration | Native (o-series) | Native (extended thinking) |
| MCP support | Native | Native (Anthropic-originated) |
| Hosted tools | Web search, file search, computer use | Computer use; web search via MCP server |
| Voice | Separate Realtime API | Separate audio endpoints |
| Best fit | Production agents on GPT, teams on OpenAI/Azure | Production agents on Claude, MCP-heavy stacks |
Pick the vendor SDK that matches your model. If you're on GPT, use the OpenAI Agents SDK; if you're on Claude, use the Anthropic Agent SDK. The first-party SDKs give you tracing, model-specific optimisations, and tighter integration with their respective tooling. Use LangGraph when you want explicit graphs or vendor-neutral. Use ADK when you're on GCP. Use multiple together via A2A when production has multiple surfaces.
Six patterns that play to the SDK's strengths: structured handoffs, guardrails, automatic tracing, hosted tools, OpenAI's reasoning quality.
Same logic as the Anthropic SDK leaf: if you've picked GPT as the model, this SDK is the natural choice. If you haven't, the model decision drives the framework decision. Picking the SDK without GPT only makes sense if you're using its OpenAI-compatible-API support to drive Ollama or vLLM — in which case the SDK is doing less work for you than its first-party path.
openai SDK with your own loop is smallerSouth Africa NorthThe Azure OpenAI Service hosts GPT models in Azure South Africa North (Johannesburg) for SA-resident inference, with Microsoft enterprise contracting and POPIA-compliant data handling. For SA banks, insurers, and telcos with existing Microsoft / Azure relationships, this is the structurally clean answer for OpenAI-on-OpenAI workloads. Caveats: not every model is available in every region (newest GPT releases sometimes lag US regions by weeks or months), and Azure pricing differs from OpenAI Platform pricing.
For studios without enterprise residency requirements, going direct to OpenAI Platform is simpler and usually cheaper. Free tier covers pilots; usage-based billing scales to production. Tracing, evals, and prompt management all on the same Platform dashboard. The OpenAI ecosystem moves fast — new models / features land on Platform first, Azure second.
OpenAI is USD-billed. At pilot volume the cost is minor; at production volume it's a real line item. Same mitigations as the Claude leaf apply: tier routing (use cheaper models for routine traffic, escalate to flagship only when needed), prompt caching (OpenAI added this in late 2024 — significant cost saver for RAG and long-system-prompt agents), and the Batch API for nightly workloads (~50% discount). For SA studios watching FX, all three are worth wiring in from day one.
localhost:11434. Pattern: SDK + Ollama for fully local agent dev.South Africa North is the SA-residency-clean path for GPT workloads.