Order the steps of one handoff in the OpenAI Agents SDK Runner loop
- 1Runner resumes the loop with research_agent as the active agent
- 2Runner intercepts the call, recognises it as a Handoff rather than a regular tool
- 3Runner seeds research_agent's input with the handoff payload (and optional conversation context)
- 4Runner ends the current agent's turn and swaps the active agent to research_agent
- 5The agent's model emits a tool call named transfer_to_research_agent with a structured payload
- 6Runner invokes the current agent with the conversation and the agent's tool set including handoff tools
Runner invokes the agent, the model emits a handoff tool call, the Runner intercepts and swaps active agents, then seeds the new agent's input and continues the loop.
Think of a customer-service desk. A representative is helping you, sees that your problem is really a billing question, and writes a referral card to the billing specialist. The receptionist takes the card, calls the billing specialist over, hands them the card so they know what you came in for, and the conversation continues with the new specialist. The model is the rep, the Runner is the receptionist, the referral card is the handoff payload, and the swap is invisible to you. The whole point is that the rep does not have to walk you over personally; the system handles that part.
Detailed answer & concept explanation~5 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.
5 to 7 min: the six-step cycle in order + why each step matters + how interception distinguishes handoffs from tools + payload seeding behaviour + design wins of handoff as tool call.
Real products, models, and research that use this idea.
- OpenAI's published Agents SDK tutorials walk through this exact six-step flow for the canonical triage / specialist / escalation pattern.
- Customer-support agent demos route a query through a triage agent that hands off to billing, technical, or returns specialists via this mechanism.
- OpenAI's TypeScript Agents SDK mirrors the same Runner / Handoff design as the Python version, with the same six-step cycle.
- Anthropic's published agent traces show similar handoff semantics in their Claude-based tooling, even though the implementation differs.
- LangGraph's swarm prebuilt implements the same mechanism with conditional edges and a designated handoff tool registry.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat happens if the model emits a handoff call to a target that is not in the registered handoffs?
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.
Confusing a handoff with a tool call. From the model's perspective they look identical (both are tool calls), but the Runner treats handoffs as a control-flow primitive that swaps the active agent, not as a function that returns a value.
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.