Why the OpenAI Agents SDK keeps Agent, Handoff, and Runner as its only three primitives
Three primitives cover the 'a few agents that hand off to each other' case beautifully and stay out of the way; anything beyond it you build yourself or pick a different framework.
Imagine the kitchen aisle. Some gadget brands sell you 40 different specialised tools (an avocado slicer, a strawberry huller, a banana peeler). Others sell you a really good knife and trust you with the rest. The Agents SDK is the really good knife brand. It says: most agent work is one agent doing the job until it hands the task to a teammate; we will make that one motion clean and let you bring your own kitchen for everything else. The trade is honest. You give up shelves of specialised gadgets in exchange for fewer ways to cut yourself.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 to 5 min: name the three primitives, explain the workload bet, contrast with LangGraph and AutoGen 0.4 surface areas, name when each framework wins.
from agents import Agent, Runner
billing = Agent(name="billing",
instructions="Handle billing questions.",
tools=[lookup_invoice, issue_refund])
tech = Agent(name="tech",
instructions="Handle technical issues.",
tools=[search_kb, escalate_to_oncall])
triage = Agent(name="triage",
instructions="Route the user to the right specialist.",
handoffs=[billing, tech])
result = Runner.run_sync(triage, "My invoice looks wrong")
print(result.final_output)Real products, models, and research that use this idea.
- OpenAI's own documentation example builds a triage agent that hands off to billing, refund, and tech-support specialists.
- Klarna and Stripe-style customer-support routing fits the agent plus handoff pattern cleanly.
- Hugging Face's smolagents adopted a similar peer-handoff idiom via ManagedAgent wrappers.
- LangGraph offers create_swarm as the corresponding shape on its typed state graph runtime.
- Anthropic's published agent design guidance recommends the handoff as tool call pattern as a portable production idiom.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you add structured shared state across multiple agents in the SDK?
QWhat is the safety story for peer handoffs in the SDK?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Expecting the SDK to cover parallel fan-out, durable resume, or graph topologies. It explicitly does not; that is the design centre, not a gap.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.