← Back to all agents
Framework Open Source
OpenAI Agents SDK
OpenAI’s official lightweight framework for multi-step, handoff-based agents.
Our take
Minimal and opinionated — ideal if you live in OpenAI’s ecosystem and want agent handoffs done right.
What it is
The OpenAI Agents SDK is an open-source, production-ready framework for building agentic AI apps. It focuses on a few powerful primitives — agents, handoffs, guardrails, and sessions — and is the successor to the experimental Swarm project. It pairs natively with OpenAI models and tools.
Best for
- Build agents that hand tasks off to specialized sub-agents
- Add input/output guardrails to an LLM app
- Stay close to OpenAI’s recommended patterns
Pros
- Official, well-maintained by OpenAI
- Clean, minimal mental model (agents + handoffs)
- First-class tracing via the Traces dashboard
Cons
- Strongest when paired with OpenAI models
- Fewer integrations than LangChain/LangGraph
Quick start
- Install: `pip install openai-agents` (Python) or `npm i @openai/agents` (TypeScript, beta).
- Import: `from agents import Agent, Runner` and set `OPENAI_API_KEY`.
- Define a primary agent: `Agent(name="triage", instructions="You triage support tickets")`.
- Run: `result = Runner.run_sync(triage, "the user said: ...")` — synchronous, async helpers also available.
- Add handoffs (other agents the LLM can route to), guardrails (input/output validators), and tracing (free Traces dashboard).
Sample input / output
Input
Build a 2-agent "TriageBot":
from agents import Agent, Runner
billing = Agent(name="Billing", instructions="Resolve billing questions.")
support = Agent(
name="Support",
instructions="You triage tech-support tickets. Hand off to Billing for invoice issues.",
handoffs=[billing],
)
out = Runner.run_sync(support, "I was double-charged on my last invoice") Output
Trace: support → (handoff:reason=invoice) → billing → (tool_call: process_refund) → final.
Final message: "I'm processing your $39 refund now. Reply with the invoice number to confirm." Full trace visible at platform.openai.com/traces. Benchmarks
GitHub stars 18,000+ — github.com/openai/openai-agents-python
License MIT
Primitives Agents + Handoffs + Guardrails + Sessions + Tracing
Produced by OpenAI; successor to the experimental Swarm framework
April 2026 update Native sandbox + harness separation (compute ↔ control); supports multi-container parallel execution — OpenAI / TechCrunch
Pricing
Free library; pay OpenAI API usage
Underlying models
Self-hosting
Yes — OpenAI Agents SDK can be self-hosted under the MIT license. This gives you full control over data and deployment.
Should you pick this?
Pick it if You live in OpenAI's ecosystem and want the least-surprise path — handoffs, guardrails, and tracing are first-class, and you get a hosted Traces UI for free.
Skip it if You want framework-agnostic across multiple model vendors — LangGraph or CrewAI don't lock you in. For heavier graph control or Python data workloads, LangGraph is the better fit.