Newsletter, guides
Multi-agent coordination patterns that work
The three ways to coordinate AI agents (chain, router, supervisor), when each fits, the typed handoff between them, and when one agent is better.
One agent with 20 tools and a 3,000 word prompt gets worse as you add features. It picks the wrong tool, mixes up instructions, and when the output is bad you cannot tell which step failed. Splitting it into specialists fixes that, and creates a new problem: coordination.
Multi-agent coordination comes down to three patterns. A chain passes one agent’s output to the next in a fixed order. A router classifies the request and sends it to one specialist. A supervisor holds the plan, hands subtasks to workers and decides what happens next, which allows loops and replanning. Start with the simplest one that fits, and connect agents with typed outputs.
# filename: router.py
# description: A router that must return one of a fixed set of specialists.
from typing import Literal
from pydantic import BaseModel
class Route(BaseModel):
agent: Literal['billing', 'support', 'sales']
reason: str
route = llm.with_structured_output(Route).invoke(user_message)
reply = AGENTS[route.agent].invoke(user_message)
Key takeaways
- A chain is a fixed pipeline. Use it when the steps are known and run in order, like research, then analysis, then writing.
- A router is one classification and one handoff. Use it when requests fall into clear types that need different tools or instructions.
- A supervisor is a loop with shared state. Use it when step 2 depends on what step 1 found, or work must go back for another round.
- Put a typed schema between agents. Free text handoffs are where multi-agent systems break.
- Multi-agent costs more tokens and adds failure points. Anthropic measured multi-agent research runs at about 15 times the tokens of a chat. Use it when the work splits into parallel parts.
- Every loop needs a stop rule: a round limit, a budget, and a person to hand to.
When should you use more than one agent?
When one prompt is doing jobs that pull against each other, or when the work splits into parts that can run in parallel. Three signs:
- Context clutter. Writing style rules distract the model while it does arithmetic, and the reverse.
- Tool confusion. Too many tools in one prompt, and the agent picks the wrong one.
- Debugging blind spots. When the answer is bad, you cannot tell whether research or writing failed.
The counter case is real too. Cognition’s June 2025 post argued against splitting work that needs shared context, because parallel agents make conflicting decisions they cannot see. Anthropic’s research system reached the same line from the other side: multi-agent fits broad, parallel research, and fits most coding work poorly, because coding tasks share too much context. If your task is one tight thread of decisions, keep one agent and give it better tools. See the tool calling guide for that route.
What is the chain pattern?
A chain runs agents in a fixed order, and each one gets the previous one’s output. Anthropic’s agent patterns call this prompt chaining. It is the easiest pattern to test, because each link has one input and one output you can check on its own.
Example: a competitor report. A researcher agent gathers facts, an analyst agent finds trends, a writer agent drafts the report.
The weak point is the interface. If the researcher dumps ten pages of loose text, the analyst drowns. Make each link return a schema:
# filename: chain.py
# description: A typed interface between two links of a chain.
from pydantic import BaseModel
class Research(BaseModel):
company: str
revenue_by_year: dict[int, float]
recent_news: list[str]
research = researcher.with_structured_output(Research).invoke({'company': 'Acme Inc'})
analysis = analyst.invoke({'research': research.model_dump()})
Now you can rewrite the researcher completely. As long as it returns Research, the analyst does not change. Add a check between links too: if revenue_by_year is empty, stop the chain instead of letting the writer invent numbers.
What is the router pattern?
A router reads the request, picks one specialist and hands over. It does no work itself. Each specialist gets a short prompt and only the tools it needs, so a billing agent cannot call a support tool by mistake.
Force the router to choose from a fixed list, as in the snippet at the top. A Literal type in a structured output, or a tool call per destination, means the router cannot answer “probably support, maybe billing”. The OpenAI Agents SDK models handoffs this way: each target agent is exposed to the model as a tool named like transfer_to_refund_agent.
Measure the router like a classifier. Collect 100 real requests, label the right destination, and track accuracy. A wrong route means the right expert never sees the question, and no specialist prompt can fix that.
What is the supervisor pattern?
A supervisor keeps the plan and the shared state, sends subtasks to workers, reads what they return and decides the next step. Anthropic calls this orchestrator-workers. It is the only one of the three patterns that loops, so it can replan when a result changes the plan.
Example: a travel planner. The supervisor asks a flight agent for options, sees the flight lands at 10 PM, and asks the hotel agent for 24 hour check-in near the airport. Neither worker knows the whole plan. They take a task and return data.
# filename: supervisor.py
# description: Shared state and a supervisor step that picks the next worker.
from typing import TypedDict
class TripState(TypedDict):
destination: str
flights: list[dict]
hotels: list[dict]
rounds: int
def supervisor(state: TripState) -> str:
if state['rounds'] >= 5:
return 'hand_to_human'
if not state['flights']:
return 'flight_agent'
if not state['hotels']:
return 'hotel_agent'
return 'finish'
In LangGraph this function becomes a conditional edge, and the state is checkpointed so a crash or a human review does not lose the run. The LangGraph persistence guide covers how that state is stored.
How do you build a loop that sends work back?
Take a coding team of agents: a coder, a reviewer and a tester. If the tests fail, the code goes back to the coder. That return path makes it a supervisor loop, not a chain, and someone must own the decision that the work is done.
Let a deterministic check own it where you can. “The test suite passed” is a better finish line than “the reviewer agent said it looks good”. Then cap the loop: after three failed rounds, stop and hand the run to a person with the full history. Without a cap, two agents can pass the same broken change back and forth until the budget runs out.
How do you choose between chain, router and supervisor?
Ask two questions.
- Do the steps depend on what earlier steps found? If no, use a chain. If yes, you need a supervisor.
- Is the job one of a few known request types? If yes, put a router in front, and each route can be a single agent, a chain or a supervisor.
Real systems mix them. A support bot is often a router whose billing route is a chain and whose technical route is a supervisor. Start with the simplest version, measure where it fails, and add a pattern only where the failure is.
What to do next
- Write down the steps your single agent does today and mark which ones depend on earlier results.
- If nothing loops, split it into a chain with a Pydantic model between every link.
- If requests fall into clear types, add a router with a
Literaloutput and measure its accuracy on labeled requests. - Use a supervisor only where work must go back for another round. Give it a round limit, a budget and a human handoff.
- Log every handoff with its input and output, so a bad answer points to one agent.
- Compare cost and quality against the single agent version before you ship the split.
Frequently asked questions
What are the main multi-agent coordination patterns?
Three cover most systems. A chain runs agents in a fixed order and passes outputs along. A router classifies a request and hands it to one specialist. A supervisor, also called orchestrator-workers, holds a plan and shared state, assigns subtasks and loops until the work is done. Real systems often combine them.
When should I use a supervisor instead of a chain?
Use a supervisor when later steps depend on what earlier steps found, or when work has to go back for another round, such as failed tests returning to a coder. Use a chain when the steps and their order are known up front. Chains are cheaper and easier to debug.
Are multi-agent systems better than a single agent?
Not by default. They help when work splits into parallel parts or when one prompt carries conflicting jobs. Anthropic reported a 90.2 percent gain on its internal research eval from a multi-agent setup, and about 15 times the tokens of a chat. For tightly coupled work like most coding, one agent with good tools often does better.
How should agents pass data to each other?
Through typed schemas, such as Pydantic models or tool call arguments, not free text. A schema lets you validate each handoff, stop on bad data and replace one agent without touching the next.
How do I stop agents from looping forever?
Give every loop a round limit and a token or cost budget, let a deterministic check decide when work is done where possible, and hand the run to a person with its full history when the limit is hit.
Sources
- Building effective agents, Anthropic, December 19, 2024: prompt chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer.
- How we built our multi-agent research system, Anthropic, June 13, 2025: the 90.2 percent eval gain, about 15 times chat token use, and which tasks fit multi-agent.
- Don’t Build Multi-Agents, Walden Yan, Cognition, June 12, 2025: share full context, and actions carry implicit decisions.
- Handoffs, OpenAI Agents SDK documentation, accessed October 2026: handoffs exposed to the model as
transfer_to_tools.
Build what you just read, with Param, live
You read the guide
- Free Live LabSecure AI Agents with GuardrailsAgents that each sign in with their own identity, act only within the user's permissions and refuse an injected instruction.Free seat
- WorkshopDesign Production-Grade Agentic AI SystemsAn architecture for one real workflow at your company that you can take to a design review: roles, models, context, tools, approvals, failure plan and budget.$497
- BuildcampAgentic AI Buildcamp for Engineers & PMsDesign, build and deploy a production agentic AI system in four weeks$997
Or watch the recording: Build a Multi-Agent System with MCP
