Handoff

One agent yields. Another takes over.

An agent completely transfers control and relevant context to another specialist.

Level
03 · Multi-Agent
Also known as
Transfer of Control, Agent Transfer, Delegated Turn
Trade-off
Clear transfer of responsibility is achieved at the risk of losing vital context during the handoff.
Native in
OpenAI Agents SDK, Microsoft Agent Framework, LangGraph, Google ADK
The mental model

A shape you can draw on a napkin.

Agent A completes its turn, packages context, and transfers control to Agent B. A single directed handoff.

Agent AAgent B
Walk it through

A real run, step by step.

TaskA support chat. The user writes: “I was charged twice for October.”
Illustrative run.
TurnActive agentWhat happensContext passed
1TriageRecognises a billing case and calls transfer_to_billingThe conversation, the customer ID, “double charge, October”
2BillingFinds two identical invoices and refunds oneNothing. Billing keeps the conversation
3BillingThe user asks when the money arrives. Billing answers directlyNothing. Triage is no longer involved
What this shows: after the handoff the specialist owns the conversation and talks to the user itself. No central agent relays each answer, which is the difference to a Supervisor. The risk sits in the last column of turn 1: whatever triage knew and did not pass on is gone for billing.
In code

The pattern in code.

Plain Pythonpython
def run(agents, start, user_message):
    active, history = start, [user_message]
    while True:
        reply = agents[active](history)  # only the active agent runs
        if reply.handoff_to:  # e.g. the tool call transfer_to_billing
            # what is not passed on is lost
            history = reply.context_for_next or history
            active = reply.handoff_to
            continue
        # the active agent answers the user itself
        return active, reply.text
Fit

Use it, or not.

When to reach for it

  • Responsibility clearly shifts between specialists.
  • User interactions must switch to the appropriate agent.
  • Security boundaries apply per agent.

When it backfires

  • Multiple agents must contribute simultaneously.
  • Control must remain with a central supervisor.
  • Context transfer cannot be reliably bounded.
Pitfalls

Two ways this pattern will hurt you.

Context is silently truncated during transfer

The handoff carries only the last N messages. Earlier context (user preferences, constraints) is lost.

Countermeasure

Define a structured context schema for every handoff. Include user state, constraints, and pending obligations.

Handoff loops — A → B → A indefinitely

The handoff condition has no history. Agents ping-pong because each thinks the other is the right owner.

Countermeasure

Track handoff history in state. Cap total handoffs per user session and escalate to a supervisor on exhaustion.

Threat exposure

What this pattern exposes

Adopting this pattern opens these attack surfaces. Each links to its entry in the threat model.

Full threat model →
Framework support

Where Handoff is native.

Sources

Where this pattern comes from.

  1. OpenAI Agents SDK — HandoffsIn the source list

Search

Search patterns, frameworks, and pages.