Agent Architecture/Multi-Agent Patterns
Advanced10 min

Swarm & Handoffs

Peer-to-peer agent handoffs where each agent decides who to pass control to next, inspired by OpenAI's Swarm pattern.

Quick Reference

  • Swarm = no central supervisor; each agent has a handoff tool that transfers control to a peer agent
  • Handoff tools carry context: the receiving agent gets the conversation history plus a handoff message
  • Agents define their own handoff targets — agent A can hand off to B or C, but not D
  • LangGraph's create_swarm() helper builds the handoff graph from agent definitions
  • Best for customer service flows where conversation naturally routes between departments

What is Swarm?

Swarm = decentralized agent handoffs

In a swarm, there is no central supervisor. Each agent has handoff tools that transfer control to a peer agent. The currently active agent decides when to hand off and to whom.

The swarm pattern was popularized by OpenAI's experimental Swarm framework. In LangGraph, it is implemented via create_swarm(), which builds a graph where each agent node has handoff tools pointing to its allowed peers. Only one agent is active at a time -- control transfers on handoff.

No central coordinator — agents hand off to each otherTriage Agentclassify intent, routeBilling Agentinvoices, paymentsSales Agentquotes, demosSupport Agenttroubleshoot, resolvehandoffhandoffescalateescalatebilling inquiryTriage (entry)Peer agentscross-handoff

Swarm agents hand off control peer-to-peer with no central supervisor

  • No central router -- routing logic is distributed across agents
  • Each agent defines its own handoff targets (agent A can hand off to B or C, but not D)
  • Handoff is a tool call: the agent calls transfer_to_billing() to pass control
  • The receiving agent gets the full conversation history plus a handoff message
  • Best for flows where conversation naturally moves between departments or roles