Skip to main content
📖 The AI Tool Bible

OpenAI Agents SDK (Python)

A lightweight Python framework for building multi-agent LLM applications with handoffs, guardrails, and built-in tracing.

Free· SDK is free and open source (MIT-licensed). Cost is pass-through to whichever model provider you point it at — OpenAI API pricing applies when using GPT models; third-party providers billed separately.AgentsGPT-4o / GPT-4.1 / gpt-realtime (provider-pluggable via LiteLLM)
Visit website →
Best for

Python teams building production agent systems on the OpenAI Responses API who want handoffs, guardrails, tool-calling, and tracing without adopting a heavy orchestration framework.

Skip if

Teams that primarily target non-OpenAI models, need a non-Python runtime, or want an off-the-shelf UI and workflow builder rather than a code-first SDK.

OpenAI Agents SDK is a Python framework for building production agentic applications on top of LLMs — chiefly OpenAI's, but the runtime is provider-pluggable. It is the successor to OpenAI's earlier Swarm experiment and is deliberately small: a handful of primitives (Agent, Runner, Session, Handoff, Guardrail, function tools, tracing) instead of the deep class hierarchies that make larger frameworks hard to reason about. An Agent is an LLM with instructions, a set of tools, and optional structured output. The Runner drives the model-tool loop until the agent decides it is done; Sessions give you persistent conversational memory; Handoffs let one agent transfer control to another specialist agent; Guardrails run classifier-style checks in parallel to short-circuit unsafe input or output. Python functions become tools automatically via type hints and docstrings, and everything is traced by default so you can inspect each model call, tool invocation, and handoff in the OpenAI trace viewer. The SDK also ships first-class support for realtime voice agents (gpt-realtime for low-latency speech-to-speech) and 'sandbox' agents that run inside isolated workspaces for code execution or long-lived task state. It is a natural fit for teams already committed to the OpenAI Responses API who want structured orchestration without adopting a heavy framework like LangGraph or CrewAI, and it is opinionated enough to get a coherent multi-agent system running in a few dozen lines.

Editor's take

This is the framework I reach for when I want an agent system that a colleague can read in one sitting. The handoff primitive is the honest win over LangChain-era designs, and default tracing removes the usual 'why did the agent do that' debugging tax. The trade-off is real: leave the OpenAI ecosystem and half the polish evaporates.

— The AI Tool Bible editorial team

Pros

  • Very small surface area — a handful of primitives means the whole SDK fits in your head in an afternoon
  • First-class handoffs and guardrails make multi-agent and safety patterns idiomatic instead of bolt-on
  • Automatic function-to-tool conversion from Python type hints and docstrings, with structured Pydantic outputs
  • Built-in tracing viewer surfaces every model call, tool call, and handoff without extra instrumentation
  • Realtime voice agent support (gpt-realtime) is unusually mature for an agent framework
  • Provider-pluggable — you can point it at non-OpenAI models via the LiteLLM integration or a custom model provider
  • Open source under MIT, actively maintained by OpenAI itself, so it tracks new Responses API features quickly

Cons

  • ⚠️ Strongly Python-first — the JS/TS sibling exists but lags in features, and there is no other-language support
  • ⚠️ Optimised for the OpenAI Responses API; using it with Anthropic, Gemini, or local models works but loses some ergonomics (built-in tools, tracing fidelity)
  • ⚠️ Tracing dashboard is hosted by OpenAI, which some regulated teams cannot use without extra work
  • ⚠️ Fewer high-level building blocks than LangGraph/CrewAI — you write more of the orchestration and state logic yourself
  • ⚠️ Documentation assumes fluency in async Python and the Responses API; not a great first agent framework for beginners

Use cases

Multi-agent customer support with specialist handoffsVoice agents using gpt-realtime for phone or in-app callsResearch agents that plan, call tools, and summariseStructured data extraction pipelines with Pydantic outputsGuardrail-protected content moderation flowsCoding assistants with sandboxed executionInternal ops copilots that call company APIs as toolsRetrieval-augmented question answering over vector stores

Explore related

Compare with similar tools

All in Agents

LangGraph

Featured
Agents · BYO (Claude / GPT / open)
8.8

Stateful, graph-based agent orchestration from LangChain.

Freemium· Developer: $0 / seat per month · Plus: $39 / seat per month · Enterprise: Custom pricingstateful agentshuman-in-loop

CrewAI

Featured
Agents · BYO (Claude / GPT / open)
8.4

Python framework for multi-agent orchestration.

Freemium· Basic: Free · Enterprise: Custommulti-agentorchestration

Ernie Bot

Agents · Baidu ERNIE 4.0 / ERNIE X1 / ERNIE Turbo (in-house)
8.7

Baidu's Mandarin-first ChatGPT rival, powered by the ERNIE model family

Freemium· Free tier for Ernie 3.5 access; Ernie 4.0 and premium features require a paid subscription (approximately CNY 59.9/month for individual plans); enterprise API pricing via Baidu AI Cloud Qianfan platform is metered per 1K tokens.Mandarin content writing and marketing copyChinese-language document Q&A and summarisation

Moveworks

Agents · Orchestrates multiple enterprise-ready LLMs (undisclosed mix, historically including OpenAI GPT and in-house models via its Reasoning Engine)
8.7

The enterprise AI assistant that searches, answers, and takes action across your business systems

Enterprise· Enterprise-only pricing; no public tiers. Quoted per organization based on employee count, integrations, and agent scope. Contact sales for a quote.IT service desk ticket deflectionHR policy Q&A and self-service

AWS Bedrock

Agents · Multi-model: Anthropic Claude, Meta Llama, Mistral, Cohere, AI21, Amazon Nova/Titan, DeepSeek, Stability, OpenAI GPT
8.6

Build and scale generative AI applications with foundation models

Paid· Pay-as-you-go per 1K input/output tokens per model; on-demand, batch, and provisioned throughput tiers. New AWS accounts get up to $200 in credits. Enterprise agreements via AWS.Enterprise RAG chatbot over private documentsMulti-step tool-using agents via AgentCore

Claude Agent SDK

Agents · Claude Opus / Sonnet
8.6

Anthropic's official SDK for building autonomous Claude agents.

Free· Free SDK; API usage billed at Claude ratesClaude agentstool use