LLM Lab

Handoffs between agents

Instead of one boss, agents pass the conversation to whichever colleague is best placed to continue it.

Where this sits in a LangGraph application
State→Nodes→Edges & routing→Parallel (Send)→Checkpoints & interrupts→Several agents

Passing control

In the handoffs pattern each agent can decide that another one should take over. The handoff updates a state value, such as active_agent, often by returning Command(goto=..., update=...), and the graph routes the following turns to that agent. Agents talk to the user directly, so a conversation can move from triage to billing to technical support like a call being transferred.

handoffhandoffnext turn goes hereback to triageusertriagebillingsupportactive_agent
Handoffs: control moves from agent to agent (dashed), and the user always talks to whichever agent is active, recorded in the state.
from langgraph.types import Command

def triage(state: State) -> Command:
    if "charged" in state["messages"][-1].content:
        return Command(goto="billing", update={"active_agent": "billing"})
    return Command(goto="support", update={"active_agent": "support"})

# each later user turn goes straight to the agent in state["active_agent"]
def route_turn(state: State) -> str:
    return state.get("active_agent", "triage")

builder.add_conditional_edges(START, route_turn, ["triage", "billing", "support"])
A triage node hands off by naming the next agent in the state; later turns go straight to the active agent.

A worked example

“I was charged twice.” Triage sees a billing problem and hands off; billing finds the duplicate charge and confirms a refund. “Also the app crashes when I log in.” Billing recognises a technical issue and hands off to support, which asks for the app version. Each agent kept its own focused prompt and tools; the user saw one continuous conversation.

In practice

Handoffs suit multi-step, customer-facing flows where different stages need different expertise. Pass along a short summary when handing off so the next agent does not have to reread everything, and give every agent a way back to triage. Because only one agent works at a time, they do not parallelise well; use subagents or Send for that.

Easy to confuse

Check yourself · 1 of 3

In the handoffs pattern, what decides which agent answers the user next?

Check yourself · 2 of 3

How do handoffs differ from the subagents pattern?

Check yourself · 3 of 3

What is a weakness of handoffs that the docs point out?

Read more in the books

  • LangChain and LangGraph documentation, LangChain: LangChain: Multi-agent, the handoffs pattern.
  • Artificial Intelligence: A Modern Approach (4th ed.), Russell, Norvig: Ch. 18, “Multiagent Decision Making”.
All books
Labfollow the active agent
How to read this
  • Send the user’s messages one at a time. The stage map lights the agent that is active now, which is also the one replying.
  • Each handoff writes the next agent into the state (active_agent); the next user turn is routed straight to it, with no supervisor in between.