Skip to content

Multi-Agent Systems

Orchestration and handoffs

Routing, delegation, shared context

The last lesson gave you the topologies - supervisor, network, hierarchical. This one makes them mechanical: how control and context actually move between agents at runtime. Two questions decide every design - who owns the final answer, and what context crosses the boundary - and getting the second one wrong is the classic reason multi-agent systems quietly fall apart.

Two questions govern every multi-agent design

A single agent is a model in a loop with tools. The moment you add a second agent, you inherit two orthogonal decisions. Answer them explicitly and the architecture almost writes itself; leave them implicit and you get the failure modes at the end of this lesson.

1. Who owns the final answer?

Either a manager stays in charge and treats specialists as tools it calls and composes - or control is transferred so the specialist takes over and replies directly. This is the handoffs vs agents-as-tools choice.[1]

2. What context crosses over?

When one agent delegates, the other sees only what you pass it. Pass a one-line task and it works blind; pass the full trace and it costs more but stays coherent. Actions carry implicit decisions - so what you omit becomes a bug.[5]

The orchestrator loop

The productionized form of coordination is (a.k.a. the supervisor). A central LLM receives the request, dynamically decides what sub-tasks exist, delegates each to a worker, reads the results, and either delegates again or synthesizes the answer. The word that matters is dynamically: unlike fixed routing, the sub-tasks are not predefined - the orchestrator invents them at runtime from the input.[3]

Concretely, imagine a customer-support manager agent. A message arrives - "I was double-charged and the export button is broken." The manager reads it, recognises two domains, and delegates: a billing brief to one specialist, a technical brief to another. Each worker runs its own loop in its own context window, returns a result, and the manager stitches the two into one reply.

Tap a node to see what it does.

A supervisor delegates a brief down to each specialist and reads a result back up. Each worker runs in an isolated context window - it sees its own brief and nothing of its siblings. In a pure handoff the up-arrow disappears: the specialist replies to the user directly instead of returning to the manager.

Stripped to its skeleton, the orchestrator runs this loop each turn.

  1. Receive and hold context. The manager keeps the full history - it is the only agent that sees the whole picture.
  2. Decide the shape. One domain: route or hand off. Several independent domains: fan out to parallel workers. (Decomposition is planning applied to agents.)
  3. Delegate with a brief. Give each worker an objective, an output format, tool/source guidance, and a boundary. Vague delegation leads to duplicated, misaligned work.[4]
  4. Collect results. Workers return; the manager reads them. (In a handoff, the specialist has already answered the user and the loop ends.)
  5. Synthesise or loop. Enough to answer? Compose the reply. Gaps remain? Spawn more workers and repeat, until done or a step budget trips.

The supervisor is a clean, debuggable hub - but it is also a bottleneck and adds one routing call per hop. When a single supervisor manages too many workers, you go hierarchical: supervisors of supervisors. That escalation ladder is the previous lesson.

Handoffs vs agents-as-tools

These are the two API-level ways to wire the first question - and the OpenAI Agents SDK makes it an explicit choice. Ask one thing: who should own the final response?[1]

Agents-as-tools (manager pattern)

The manager stays in control and calls each specialist via Agent.as_tool(). Specialists return their work to the manager, who owns and composes the single final answer. Use when one agent should combine several specialists' work into one reply, or you need parallel multi-domain output.[1]

Handoffs (transfer of control)

Control is transferred. A makes the specialist the active agent; it replies to the user directly, with the conversation history carried along. Use when routing is the workflow - the specialist should own the reply and swap in its own focused instructions.[2]

Both are a few lines. The difference is the field you populate - handoffs=[...] transfers control; tools=[...as_tool()] keeps it.

from agents import Agent

billing = Agent(name="Billing", instructions="Answer billing questions.")
refunds = Agent(name="Refunds", instructions="Process refund requests.")

# --- Handoff: control transfers; the specialist replies to the user ---
triage = Agent(
    name="Triage",
    instructions="Route the user to the right specialist.",
    handoffs=[billing, refunds],          # transfer + conversation history
)

# --- Agents-as-tools: the manager keeps control and composes the reply ---
manager = Agent(
    name="Manager",
    instructions="Gather each specialist's answer, then write ONE reply.",
    tools=[
        billing.as_tool(tool_name="ask_billing", tool_description="Billing help"),
        refunds.as_tool(tool_name="ask_refunds", tool_description="Refund help"),
    ],
)
support_agents.py - same specialists, two wirings: handoffs=[...] transfers control, tools=[...as_tool()] keeps it.

Two ways to drive the whole thing

Orchestrating via an LLM (the manager decides who to call) is flexible but non-deterministic. For pipelines you can predict, orchestrate via code instead: classify with a structured output and if/else, or fan out with asyncio.gather. Same agents - a human writes the control flow.[1] In LangGraph the handoff primitive is Command: a node returns Command(update={...}, goto="next") to update shared state and route in one step.[8]

The two models also differ in state. Handoffs persist the conversation, so repeat requests are cheaper - roughly 40-50% fewer calls than re-invoking fresh. Agents-as-tools are stateless: every call starts clean, which is better for parallel, independent sub-tasks but wasteful for repeated back-and-forth in one domain.[7]

What the sub-agent actually sees

Here is the trap that sinks most multi-agent projects. Delegation feels like handing a colleague a ticket - but a colleague shares your hallway, your standup, your history. A sub-agent shares only the bytes you put in its context window. Cognition's two rules of context engineering are the whole lesson.[5]

Share full traces, not just messages

A worker that sees only a summarised task - not the manager's intermediate reasoning and tool calls - misreads the job. Coherence needs the whole trace, not the headline.

Actions carry implicit decisions

Every step silently commits to a style, an edge-case, a data shape. Two agents making conflicting silent choices produce pieces that cannot be merged.

The canonical cautionary tale: split "build a Flappy Bird clone" across two parallel writers. One is told "build the background" and makes a Super Mario-styled world; the other is told "build the bird" and makes art and collision assumptions that clash. Neither saw the other's decisions, so the final agent cannot reconcile them.[5] Sharing the task description is not sharing context.

Siloed writers - decisions collide

Writer A builds a Mario background; Writer B builds a clashing bird. Each made silent choices the other never saw, so the final agent cannot merge the two pieces.

Single writer + read-only helpers

One writer holds the full trace and makes all the mutating decisions; extra agents only feed it intelligence (search, review). The result stays coherent.[6]

The 2026 consensus: intelligence in, actions single-threaded

The debate converged. Multi-agent works when writes stay in one thread and extra agents add intelligence, not actions: parallel read-only search sub-agents feeding one decision-maker, a fresh-context code-review agent that catches what the writer missed, or a "smart friend" - a stronger model consulted for advice, never let loose to act.[6] This is exactly how Anthropic's research system runs: many read/search sub-agents, one lead that synthesises.[4]

Moving big results without bloating context

When a worker produces a large output, do not copy it back through the manager's context window. Have the worker write it to external memory (a filesystem or store) and pass back a lightweight reference - the "artifacts" pattern. The manager aggregates pointers, not payloads, and reads the full artifact only when it needs to.[4]

Aggregation, scaling, and where it breaks

Fan-out is only half the pattern; fan-in is where quality is won or lost. In Anthropic's research system the lead synthesises worker outputs and, when the report is complete, a dedicated citation agent maps every claim back to its exact source - a final aggregation pass, not an afterthought.[4] Two hard-won rules for the aggregation stage follow.

Scale effort to complexity - or watch it run away

Left ungoverned, an orchestrator over-delegates. An early Anthropic build spawned 50 sub-agents for a trivial query and searched endlessly for sources that did not exist. Bake explicit effort rules into the prompt: a simple fact-find is 1 agent and a few tool calls; a comparison is 2-4 sub-agents; complex research is 10+ with clearly divided tasks. Remember multi-agent already burns about 15x the tokens of a plain chat - the economics only work for high-value, parallelizable work.[4]

And the systematic failures are organisational, not just model weakness. The Berkeley MAST study annotated 200+ multi-agent traces across 7 frameworks and found gains over single-agent baselines are often marginal, with failures clustering into three buckets: specification/design (41.8%), inter-agent misalignment (36.9%), and weak verification (21.3%). The single most common failure was plain step repetition (17.1%) - agents redoing each other's work because no one owned the boundary.[9] Nearly all of these trace back to the two questions we opened with: unclear ownership and leaky context. Instrument the boundaries - tracing is how you catch them.

Check yourself

Match each orchestration decision to what it governs.

drop here

who writes the final reply to the user

drop here

transfer control to the active agent

drop here

manager keeps control and composes

A manager splits 'build a Flappy Bird clone' across two parallel writer agents, giving each only its own subtask. The pieces won't fit together. What is the root cause?

Handoff vs agents-as-tools: in one line each, who ends up talking to the user?

Decide it with a single question. Try to state it, then check.

Lock it in

  • Two questions decide the design: who owns the final answer, and what context crosses the boundary. Answer both explicitly.
  • Handoff = transfer control (specialist replies to the user); agents-as-tools = keep control (manager composes). Ask "who owns the reply?"
  • The orchestrator loop: hold context, decide shape, delegate a brief (objective, format, boundary), collect, synthesise or loop.
  • A sub-agent sees only what you pass it. Actions carry silent decisions; siloed writers collide. Keep writes single-threaded; add agents for intelligence, not actions.
  • Govern effort and instrument boundaries. Scale sub-agents to complexity (multi-agent is about 15x tokens), and trace hand-offs - most failures are ownership and context leaks, not model weakness.

Primary source

OpenAI Agents SDK, Agent orchestration (multi-agent)

The cleanest treatment of orchestrating via LLM vs via code and the handoffs vs agents-as-tools decision, with runnable Python you can lift directly.

Sources

  1. 1.OpenAI Agents SDK, Agent orchestration (multi-agent)
  2. 2.OpenAI Agents SDK, Handoffs
  3. 3.Anthropic, Building Effective Agents
  4. 4.Anthropic, How we built our multi-agent research system
  5. 5.Cognition (Walden Yan), Don't Build Multi-Agents
  6. 6.Cognition, Multi-Agents: What's Actually Working
  7. 7.LangChain, Multi-agent (docs)
  8. 8.LangChain, Command: a new tool for multi-agent architectures in LangGraph
  9. 9.Cemri et al., Why Do Multi-Agent LLM Systems Fail? (MAST, Berkeley)