- 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.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
The OpenAI Agents SDK is the 2026 reference implementation of handoff as tool call, and the Runner is the thin loop that makes it work. The full mechanism fits in six steps and a few hundred lines of code, and understanding the order of those steps is understanding why the design beats the alternatives.
The interview value of this question is not memorising step labels. It is being able to articulate the separation between what the model sees (tool calls, indistinguishable) and what the runtime does (intercept, swap, seed, resume). That separation is the design choice; everything else falls out of it.
Mental model: the model emits a tool call; the Runner recognises a handoff and swaps the active agent instead of executing a function.
The six steps, walked carefully
1. Runner invokes the current agent
The Runner constructs an LLM request from the current agent's system prompt, the running conversation, and the agent's tool schemas. Tool schemas include regular tools (search, calculator) and handoff tools (transfer_to_research_agent). To the model, both kinds look identical: JSON-schema tool definitions with a name and parameters.
2. Model emits a tool call
The model reads the conversation, decides the next action is a handoff to a specialist, and emits a tool call to the matching handoff tool. The payload is structured per the tool's schema ({ "brief": "...", "question": "..." } or whatever the developer declared).
3. Runner intercepts
After the LLM call returns, the Runner inspects the tool call. It checks the tool name against its handoff registry. If the name matches a registered handoff target, the Runner enters the handoff dispatch path instead of the regular tool-execution path. This is a simple name match, no semantic analysis.
4. End current turn and swap
The current agent's turn ends. Crucially, the Runner does NOT execute the handoff as a tool function (no result is emitted). The conversation record includes the handoff tool call as the final message of the prior agent's turn (auditable in traces). The Runner reassigns the active agent reference to the target.
5. Seed the new agent
The new agent's input is constructed from the handoff configuration. The default is structured payload only: the payload becomes a user message or a structured kickoff for the new agent. Optional configurations include forwarding the prior conversation in full or applying a custom message-filter function. The default exists because role bleed (the new agent inheriting the old agent's voice) is the most common multi-agent pathology.
6. Resume the loop
The Runner goes back to step 1 with the new agent active. The cycle continues until an agent emits a final answer (no tool call) or hits a termination condition like max_turns.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
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.
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?
The Runner treats it as an unknown tool call. The default behaviour is to surface a tool error back to the agent for the next turn, which usually causes the model to recover (try a different tool or emit a final answer). You can also configure stricter behaviour: raise immediately, or constrain the model via the tool-choice parameter to only consider registered handoffs.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases 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.
60 second bullets to scan on the way to the call.
The Runner as the loop that drives agent invocation
Why handoffs look like tool calls from the model's perspective
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.