In a multi-agent system the hard question is who holds control after each step. A supervisor keeps it: workers do a job and report back. A hierarchical handoff model passes it on: an agent (or a whole team) transfers the conversation to another node, possibly in a parent graph, and that node now owns the turn.
That one choice drives latency, token cost, who talks to the user, and how hard the system is to debug. LangGraph supports both, but the recommended APIs moved in 2026, so older tutorials are a poor guide:
langgraph-supervisor package (create_supervisor, create_handoff_tool) is create_agent supervisor that calls workers wrapped as tools.Command(goto=..., graph=Command.PARENT). create_react_agent has been replaced by This article compares the two models using the current APIs. Each gets a diagram, working Python and the trade-offs that decide between them. The examples follow the official LangChain docs listed under References.
the two coordination models · supervisor hub vs nested handoff graphs
On the left, every arrow runs both ways: the supervisor sends work out and gets the result back. On the right, arrows mostly run one way: the turn moves to the next agent, and a team escalates by jumping up to the org graph.
A supervisor is a full agent that keeps the conversation and calls workers as tools. Every result comes back to it, and it decides the next step. LangChain's docs call this the subagents pattern, and its main traits are:
interrupt() to ask for input.
A supervisor is not a router. A router is usually a single classification step that dispatches once. A supervisor reasons over several turns and can call workers in sequence, each step shaped by the last result.
from langchain.agents import create_agent
from langchain.tools import tool
from langgraph.checkpoint.memory import InMemorySaver
MODEL = "anthropic:claude-sonnet-5"
research_agent = create_agent(
model=MODEL,
tools=[web_search, fetch_page],
system_prompt=(
"You are a research specialist. Return a bullet list of findings "
"with a source URL for each. The supervisor only sees your final message."
),
)
writer_agent = create_agent(
model=MODEL,
tools=[],
system_prompt="You turn research notes into a clear 300-word brief.",
)
@tool("research", description="Find facts and sources on a topic.")
def call_research(query: str) -> str:
result = research_agent.invoke({"messages": [{"role": "user", "content": query}]})
return result["messages"][-1].content # last-message output mode
@tool("write_brief", description="Write a brief from research notes.")
def call_writer(notes: str) -> str:
result = writer_agent.invoke({"messages": [{"role": "user", "content": notes}]})
return result["messages"][-1].content
supervisor = create_agent(
model=MODEL,
tools=[call_research, call_writer],
system_prompt=(
"You coordinate a research specialist and a writer. "
"Research first, then hand the notes to the writer, then reply to the user."
),
checkpointer=InMemorySaver(),
)
config = {"configurable": {"thread_id": "brief-42"}}
supervisor.invoke(
{"messages": [{"role": "user", "content": "Brief me on LangGraph checkpointers"}]},
config,
)
The old output_mode argument (full_history or last_message) now lives in the tool wrapper. Return the last message for a lean supervisor context, or return a Command to send extra state keys back as well:
from typing import Annotated
from langchain.messages import ToolMessage
from langchain.tools import InjectedToolCallId
from langgraph.types import Command
@tool("research", description="Find facts and sources on a topic.")
def call_research(query: str, tool_call_id: Annotated[str, InjectedToolCallId]) -> Command:
result = research_agent.invoke({"messages": [{"role": "user", "content": query}]})
return Command(update={
"sources": result.get("sources", []), # extra state for the supervisor
"messages": [ToolMessage(content=result["messages"][-1].content,
tool_call_id=tool_call_id)],
})
The docs flag one failure mode in particular: a worker does the tool calls but leaves the results out of its final message. The supervisor sees only that final message, so say so in the worker's prompt.
When workers are many or owned by different teams, use a single dispatch tool in place of one tool per worker. That is one task(agent_name, description) tool backed by a registry, so new workers do not change the supervisor.
In a handoff model, an agent's tool call transfers control. The receiving agent takes over the conversation and answers the user directly. The term handoff comes from OpenAI's Agents SDK (tools such as transfer_to_sales_agent), and LangChain now uses it for the same idea.
The mechanism is a tool that returns a Command. It updates state (usually an active_agent key) and names the next node. Adding graph=Command.PARENT makes the jump target a node in the enclosing graph rather than the agent's own loop. Stack those graphs and you get a hierarchy: agents hand off laterally inside a team, and a team hands off upward to another team.
Its main traits:
active_agent persists across turns through the checkpointer.Command.PARENT goes up exactly one level. Crossing two levels needs one Command per level.
An LLM expects every tool call to be paired with its result. A handoff tool that jumps with Command.PARENT must therefore pass both the AIMessage holding the tool call and a ToolMessage acknowledging it. Pass only that pair, not the agent's whole internal history. The receiving agent otherwise inherits reasoning it cannot use, and token cost grows.
A front desk triages, a billing team (invoices and refunds) and a tech team handle the work, and billing can escalate to tech.
from typing import Literal
from typing_extensions import NotRequired
from langchain.agents import AgentState, create_agent
from langchain.messages import AIMessage, ToolMessage
from langchain.tools import tool, ToolRuntime
from langgraph.graph import StateGraph, START, END
from langgraph.types import Command
from langgraph.checkpoint.memory import InMemorySaver
MODEL = "anthropic:claude-sonnet-5"
class OrgState(AgentState): # messages already uses the add_messages reducer
active_agent: NotRequired[str] # who owns the turn inside a team
next_team: NotRequired[str] # set when a team escalates upward
def handoff_pair(runtime: ToolRuntime, note: str) -> list:
"""The AIMessage that made the call + the ToolMessage that answers it."""
last_ai = next(m for m in reversed(runtime.state["messages"]) if isinstance(m, AIMessage))
return [last_ai, ToolMessage(content=note, tool_call_id=runtime.tool_call_id)]
@tool
def transfer_to_refunds(runtime: ToolRuntime) -> Command:
"""Hand the customer to the refunds specialist."""
return Command(
goto="refunds_agent",
update={"active_agent": "refunds_agent",
"messages": handoff_pair(runtime, "Transferred to refunds")},
graph=Command.PARENT, # parent of this agent = the billing team graph
)
@tool
def transfer_to_invoices(runtime: ToolRuntime) -> Command:
"""Hand the customer to the invoices specialist."""
return Command(
goto="invoices_agent",
update={"active_agent": "invoices_agent",
"messages": handoff_pair(runtime, "Transferred to invoices")},
graph=Command.PARENT,
)
@tool
def escalate_to_tech(runtime: ToolRuntime) -> Command:
"""The problem is technical, not billing. Leave the billing team."""
return Command(
goto="exit_team", # a team-level node does the second hop
update={"next_team": "tech_team",
"messages": handoff_pair(runtime, "Escalating to tech support")},
graph=Command.PARENT,
)
invoices_agent = create_agent(MODEL, tools=[lookup_invoice, transfer_to_refunds, escalate_to_tech],
system_prompt="You explain invoices.", name="invoices_agent")
refunds_agent = create_agent(MODEL, tools=[issue_refund, transfer_to_invoices, escalate_to_tech],
system_prompt="You process refunds.", name="refunds_agent")
def as_node(agent):
def node(state: OrgState):
return agent.invoke(state)
return node
BILLING = ("invoices_agent", "refunds_agent")
def billing_entry(state: OrgState) -> str:
active = state.get("active_agent")
return active if active in BILLING else "invoices_agent"
def after_billing_agent(state: OrgState) -> str:
last = state["messages"][-1]
if isinstance(last, AIMessage) and not last.tool_calls:
return END # the agent answered the user: turn over
return billing_entry(state)
def exit_team(state: OrgState) -> Command[Literal["tech_team"]]:
"""Second hop: from the team graph up to the org graph."""
return Command(goto=state["next_team"], update={"active_agent": None},
graph=Command.PARENT)
billing = StateGraph(OrgState)
billing.add_node("invoices_agent", as_node(invoices_agent))
billing.add_node("refunds_agent", as_node(refunds_agent))
billing.add_node("exit_team", exit_team)
billing.add_conditional_edges(START, billing_entry, list(BILLING))
for name in BILLING:
billing.add_conditional_edges(name, after_billing_agent, [*BILLING, END])
billing_team = billing.compile() # no checkpointer: inherits the parent's
tech_team = build_tech_team() # same shape: its own agents and handoff tools
@tool
def transfer_to_billing_team(runtime: ToolRuntime) -> Command:
"""Invoices, charges and refunds."""
return Command(goto="billing_team",
update={"messages": handoff_pair(runtime, "Routed to billing")},
graph=Command.PARENT)
@tool
def transfer_to_tech_team(runtime: ToolRuntime) -> Command:
"""Bugs, outages and login problems."""
return Command(goto="tech_team",
update={"messages": handoff_pair(runtime, "Routed to tech support")},
graph=Command.PARENT)
front_desk = create_agent(MODEL, tools=[transfer_to_billing_team, transfer_to_tech_team],
system_prompt="Greet the customer and route them to the right team.")
org = StateGraph(OrgState)
org.add_node("front_desk", as_node(front_desk))
org.add_node("billing_team", billing_team) # compiled subgraph = a node (shared state keys)
org.add_node("tech_team", tech_team)
org.add_edge(START, "front_desk")
graph = org.compile(checkpointer=InMemorySaver())
escalation path in the support-org example · 3 graph levels, 4 steps
The escalation path, hop by hop: the tool can only reach its own team graph, so exit_team exists to carry the turn up the second level.
Three details make this work. Each Command.PARENT climbs exactly one level, so escalation is two hops: the tool jumps to exit_team, and exit_team jumps to the org graph. Shared keys that a subgraph writes into its parent need a reducer on the parent; messages has one already. And only the outermost graph gets a checkpointer.
The docs recommend a single agent with middleware for most handoff cases. One create_agent keeps a current_step key, and a @wrap_model_call middleware swaps the system prompt and tool list for each step. Tools move the step forward with Command(update={"current_step": ...}). Keep separate subgraphs for agents that are complex graphs in their own right, such as one with a reflection or retrieval loop.
The supervisor buys control, isolation and parallelism with an extra model call on every request. Handoffs buy conversational speed with weaker isolation and no parallel fan-out.
| Dimension | Supervisor (subagents as tools) | Hierarchical handoff (Command.PARENT) |
|---|---|---|
| Who holds control | The supervisor, always | Whichever agent holds the turn |
| Who talks to the user | Supervisor only (workers via interrupt() ) |
The active agent, directly |
| Context per agent | Isolated: each call starts clean | Shared message history; you filter at each handoff |
| Parallel work | Yes, several tool calls per turn | No, one agent at a time |
| Multi-hop chains | Yes, the supervisor sequences them | Yes, agents pass the turn along |
| State across turns | Kept by the supervisor; workers stateless by default | active_agent persists, so the next turn skips re-routing |
| Adding an agent | One new tool (or a registry entry) | New node, plus handoff tools in every agent that may reach it |
| Debugging | One decision point to trace | Control path spread across agents and levels |
| Typical fit | Research, analysis, multi-domain synthesis | Support desks, intake flows, step-gated processes |
In LangChain's own scoring, the subagents pattern rates five of five on distributed development, parallelization and multi-hop, but one of five on direct user interaction. Handoffs rate five of five on multi-hop and user interaction and offer no parallelization.
LangChain multi-agent overview, performance comparison · 3 scenarios, model calls (tokens for multi-domain)
Stateful handoffs skip re-routing on a repeat request because the active agent is still in place. The supervisor repeats its full flow every time, but in parallel, isolated calls it processes about a third fewer tokens on multi-domain work.
Both models follow one rule: compile only the outermost graph with a checkpointer and pass a thread_id on every call. Inner agents and team subgraphs are compiled without one. They then use per-invocation persistence: each call starts fresh but inherits the parent's checkpointer, which is what lets interrupt() and durable execution work inside them.
Subgraph checkpointer= |
Mode | Behaviour | Use it for |
|---|---|---|---|
None (default) |
Per-invocation | Fresh each call; supports interrupts within the call | Most workers and teams |
True |
Per-thread | History accumulates on the thread | A worker that must remember earlier calls |
False |
Stateless | Plain function call, no interrupts | Pure, fast transforms |
Three consequences differ by model:
__interrupt__ on the outer graph. Resume it with graph.invoke(Command(resume=value), config). get_state(..., subgraphs=True) will not show their state. Team subgraphs added as nodes in a handoff hierarchy checkpointer=True worker must not be called in parallel, because both calls write to the same namespace. Cap it with ToolCallLimitMiddleware, and give each distinct per-thread worker its own namespace.
config = {"configurable": {"thread_id": "ticket-981"}}
result = graph.invoke({"messages": [{"role": "user", "content": "Refund order 5521"}]}, config)
if "__interrupt__" in result: # e.g. refunds_agent asked for approval
graph.invoke(Command(resume={"approved": True}), config)
state = graph.get_state(config, subgraphs=True)
Start from one question: does a specialist need to hold a conversation with the user? If not, use a supervisor. If yes, use handoffs, and add levels only when teams need their own internal routing.
choosing a coordination model · 3 questions, 4 outcomes
Read it top down: each "yes" to user contact pushes you toward handoffs, and only teams with their own routing justify a second level.
The two models compose, because a whole graph can be a tool and a whole agent can be a node:
@tool that invokes it and returns the final message. The supervisor sees one tool; the team keeps its own lateral routing.StateGraph around both.
Before any of these, check whether you need more than one agent at all. A single agent with the right tools, or with skills loaded on demand, often matches a multi-agent design at lower cost.
The supervisor trades speed for control; the handoff hierarchy trades control for a natural conversation. Each one's strengths are the other's weaknesses.
| Advantages | Disadvantages |
|---|---|
| One place to reason and trace. Every decision is a supervisor tool call, so a single LangSmith trace shows the whole plan. | An extra model call on every request. The result passes back through the supervisor before the user sees it: 4 calls against 3 for a one-shot request. |
| Clean context per worker. Each call starts fresh, so a worker's long tool output never bloats the main conversation. | Repeats work on follow-ups. Workers are stateless by default, so "do that again" costs the full flow: 8 calls over two turns against 5 for handoffs. |
| Parallel fan-out. Several workers run in one turn: about 9K tokens against 14K+ for handoffs on a three-domain task. | The supervisor is a bottleneck. If its prompt or routing is weak, every request suffers; it is a single point of failure for quality. |
| Easy to extend and to split across teams. A new worker is one tool or one registry entry; teams can own and deploy workers independently. | Workers cannot hold a conversation. They reach the user only throughinterrupt() , and the supervisor rephrases everything they say. |
| Guardrails in one spot. Approval, budgets and policy checks wrap the supervisor's tools. | Lossy hand-back. The supervisor sees only what the worker returns; a weak final message loses work. |
| Simple persistence. One checkpointer on the supervisor; interrupts bubble up through any depth. | Opaque worker state. Workers called inside tools are invisible toget_state(subgraphs=True) . |
| Advantages | Disadvantages |
|---|---|
| Fewest calls in conversation. The specialist answers the user directly, with no hop back through a coordinator. | No parallelism. One agent holds the turn at a time, so multi-domain work runs in series and costs more calls and tokens. |
Sticky specialists.active_agent persists, so the next user message goes straight to the right agent with no re-routing. |
Control is spread out. Following a bug means tracing a path across agents and graph levels, not one decision point. |
| Natural, multi-turn dialogue. The specialist keeps its own voice and can ask clarifying questions in-line. | Context engineering is on you. Every handoff must pass a validAIMessage andToolMessage pair, and you decide what history goes along. |
| Mirrors real organisations. Teams own their internal routing, and escalation paths map to how support desks really work. | Wiring grows with the graph. Each new agent needs handoff tools in every agent that can reach it; cross-level jumps need oneCommand per level. |
| Enforces order. Capabilities unlock only after a step completes, such as warranty checked before refund. | Loops and ping-pong. Two agents can bounce a user between them; you need guards such as a hop counter. |
| Inspectable levels. Team subgraphs added as nodes are discoverable, with a checkpoint namespace per level. | Shared-key pitfalls. Keys written across levels need reducers on the parent, or updates collide. |
Use a supervisor when the work is a task to complete. Use handoffs when the work is a conversation to hold. Read the request for these signals:
| Signal in the requirements | Points to | Why |
|---|---|---|
| "Research, compare, summarize, analyze across sources" | Supervisor | Independent subtasks run in parallel with isolated context |
| Several distinct domains or tool sets (calendar, email, CRM, database) | Supervisor | Tools split into focused workers; one agent stops choosing among dozens of tools |
| Results must be combined, checked or ranked before the user sees them | Supervisor | Only a coordinator sees every result |
| Workers built and shipped by different teams | Supervisor (single dispatch tool) | A registry adds workers without touching the coordinator |
| Strict audit trail or one approval gate for all actions | Supervisor | Every action passes one decision point |
| "Transfer me to", "talk to billing", departments, escalation | Handoffs | The specialist must own the conversation |
| Steps must happen in order (verify, then act) | Handoffs, single agent + middleware | State unlocks tools only after the step completes |
| Long multi-turn dialogue with one specialist | Handoffs | active_agent keeps the next turn with them, saving calls |
| Departments with their own sub-specialists | Hierarchical handoffs | Teams own internal routing; escalation crosses levels |
| A specialist is itself a complex graph (reflection, retrieval loop) | Handoffs, agent subgraphs | Bespoke graphs become nodes |
| Fixed steps beside agents (validation, ETL, API calls) | Custom StateGraph wrapping either |
Deterministic logic should not depend on an LLM's routing |
Use neither when one agent with a handful of well-described tools does the job, or when skills loaded on demand cover the specialist knowledge. Multi-agent adds calls, latency and failure modes; add it when a single agent measurably starts picking the wrong tools or overflows its context.
Most real systems sort along two questions: who talks to the user, and whether the work fans out or runs in steps. The map below places common use cases on those two axes. The catalogue then gives the architecture for each.
use-case map · 10 use cases from the catalogue below, placed by quadrant only
The left half is supervisor territory and the right half is handoff territory. The top-right corner is where the two combine.
| Use case | Model | Architecture | Key LangGraph pieces |
|---|---|---|---|
| Customer support desk (billing, tech, sales) | Hierarchical handoff | Front-desk triage agent in an org graph; each department a team subgraph; lateral handoffs inside a team; escalation through an exit node | Command.PARENT ,active_agent , team subgraphs,interrupt() for human takeover |
| Warranty, refund or KYC intake | Handoff, single agent | One create_agent with acurrent_step key; middleware swaps prompt and tools at each step |
@wrap_model_call ,Command(update=...) , checkpointer |
| Research reports, due diligence, competitive analysis | Supervisor | Supervisor fans out search and analyst workers in parallel, then calls a writer worker; sources return as state | Parallel tool calls, stateless workers, Command with extra keys |
| Personal or executive assistant (calendar, email, CRM) | Supervisor | One worker per domain; human approval before outbound actions such as sending email | Human-in-the-loop on worker tools, interrupt() |
| Enterprise knowledge Q&A (GitHub, Notion, Slack) | Router, or supervisor for follow-ups | Classify the query, query source agents in parallel, synthesize; promote to a supervisor when answers need multi-step reasoning | Router step, tool-wrapped source agents |
| Code review or PR pipeline | Custom StateGraph + supervisor |
Deterministic fetch, lint and test nodes, then a supervisor runs security, performance and style reviewers in parallel; a merge node posts findings | StateGraph nodes, supervisor node, forked input to share the diff analysis |
| IT helpdesk with departmental sub-specialists | Hybrid: hierarchical handoff + inner supervisor | Org graph routes to team subgraphs; each team's lead agent supervises its diagnostic workers | Team subgraph whose entry agent has tool-wrapped workers |
| Sales assistant (qualify, demo, pricing, human closer) | Flat handoffs | One agent subgraph per stage; final handoff to a human | active_agent ,interrupt() |
| Content pipeline (outline, draft, edit, SEO) | Supervisor, sequential | Supervisor sequences workers and loops the editor until it approves | Multi-hop tool calls, an iteration cap |
| Data analytics or SQL assistant | Single agent + skills, or supervisor | Schema knowledge loaded as skills; a supervisor once questions span warehouse, BI and docs | Skills, a per-thread worker for session memory |
1. Support desk: hierarchical handoff
org graph (StateGraph, checkpointer here only)
├── front_desk create_agent · tools: transfer_to_billing_team, transfer_to_tech_team
├── billing_team compiled StateGraph, no checkpointer
│ ├── invoices_agent ⇄ refunds_agent lateral handoff, Command.PARENT
│ └── exit_team Command.PARENT → tech_team (second hop)
└── tech_team compiled StateGraph, no checkpointer
├── diagnose_agent ⇄ resolve_agent
└── human_takeover interrupt() → resume with Command(resume=...)
Add a hop counter in state so two agents cannot pass a customer back and forth forever.
2. Research report: supervisor with parallel workers
supervisor (create_agent, checkpointer)
├── tool research(query) → research_agent [web_search, fetch_page] called N times in one turn
├── tool analyze(notes) → analyst_agent [python_repl]
└── tool write_report(notes) → writer_agent []
extra state returned through Command: sources[], open_questions[]
Prompt each worker to put its full results in its final message, since that is all the supervisor sees.
3. PR review: custom StateGraph wrapping a supervisor
START → fetch_diff → run_linters → run_tests ──fail──→ report_failures → END
└──pass──→ review_supervisor (create_agent)
├── security_reviewer (parallel)
├── performance_reviewer (parallel)
└── style_reviewer (parallel)
→ merge_findings → post_comments (interrupt: approve) → END
The deterministic steps never depend on an LLM's routing; agents only do the judgment work.
| Symptom | Cause | Fix |
|---|---|---|
| Receiving agent errors or gives odd answers after a handoff | Tool call left without a matching result | Pass the AIMessage with the call plus aToolMessage using the sametool_call_id |
| Context balloons after a few handoffs | Whole internal history passed along | Pass only the handoff pair; summarize prior work in the ToolMessage text |
| Supervisor "forgets" what a worker found | Results missing from the worker's final message | Tell the worker the supervisor only sees its final message, or return extra keys via Command |
Command.PARENT update overwrites or raises on a shared key |
No reducer for that key on the parent | Add a reducer ( messages has one; define one for custom lists) |
| A node runs twice or the graph will not end | add_edge from a node that also routes withCommand |
Route from that node with Command alone; static edges still run |
interrupt() is never surfaced, or resume fails |
Inner agent has its own checkpointer, or no thread_id |
Checkpointer on the outermost graph only; always pass thread_id |
| Checkpoint conflicts on a stateful worker | Parallel calls to a checkpointer=True worker |
Limit calls with ToolCallLimitMiddleware ; give each per-thread worker its own namespace |
| Escalation lands in the wrong place | Expecting Command.PARENT to jump two levels |
One Command per level, as in theexit_team node above |
| Old tutorial code breaks | create_supervisor andcreate_react_agent are legacy |
Move to create_agent with tool-wrapped workers (see the migration guide) |
Items 1 to 12 are LangChain docs pages, researched through the LangChain docs MCP server on 25 November 2026; code examples follow pages 2, 3, 4, 7 and 9.