LLM Lab

Choosing a multi-agent pattern

Several agents can split a task and check each other. They also cost more, so the split has to pay for itself.

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

Splitting the work

In a multi-agent system, each agent has its own role, prompt and sometimes its own tools. Common layouts: a pipeline (planner, then worker, then reviewer) or a planner with workers that run in parallel and report back.

What it buys and costs

A reviewer can catch mistakes; specialised prompts can stay short and focused. But every message is extra tokens and extra latency, and agents can misread each other. Use the lab to run the same task three ways and compare quality with cost.

In LangGraph

The LangChain documentation describes five multi-agent patterns. Subagents: a main agent calls the others as tools and keeps control. Handoffs: the active agent changes, and agents talk to the user directly. Skills: one agent loads specialised prompts or knowledge on demand. Router: classify the request, send it to specialised agents, combine results. Custom workflow: your own LangGraph graph mixing fixed steps and agents.

subagents: one in control
usermainagent Aagent B
handoffs: control moves
handoffuseragent Aagent B
router: classify, then dispatch
routeragent Aagent B
Three of the five patterns side by side. Subagents keep one agent in charge; handoffs pass control and the conversation along; a router classifies once and dispatches. Skills and custom workflows build on the same pieces.
# subagents: the supervisor stays in control
supervisor = create_agent(model=..., tools=[call_researcher, call_writer])

# handoffs: a node or tool moves control to another agent
return Command(goto="billing_agent", update={"active_agent": "billing"})
The two most common patterns side by side; the supervisor and handoffs lessons build each one.

A worked example

On the task “write is_even(n)”, a single agent writes n % 2 == 1 and stops after about 160 tokens: wrong. A writer with a reviewer gets the same bug caught and fixed, at about 650 tokens. A planner with two workers also succeeds, at about 940 tokens. The extra agents bought correctness here, at four to six times the cost.

one agent160 tokens · wrong
writer + reviewer650 tokens · correct
planner + 2 workers940 tokens · correct
The lab’s three set-ups on the same task. Adding a reviewer catches the bug at four times the tokens; a planner with workers costs more again. Extra agents have to pay for themselves.

In practice

Use several agents when the work splits cleanly (independent research threads, separate files) or when a second, differently prompted pass catches real errors. Give each agent a narrow role and a clear hand-off format, and measure whether the team beats a single well-prompted agent before keeping it.

Easy to confuse

Check yourself · 1 of 3

What is the main reason to add a reviewer agent to a coding agent?

Check yourself · 2 of 3

Compared with one agent, a team of agents usually costs…

Check yourself · 3 of 3

When is a single agent the better choice?

Read more in the books

  • LangChain and LangGraph documentation, LangChain: LangChain: Multi-agent (subagents, handoffs, skills, router, custom workflow).
  • An Introduction to MultiAgent Systems (2nd ed.), Michael Wooldridge: Ch. 1, “Introduction” and the chapters on multiagent interactions.
  • Artificial Intelligence: A Modern Approach (4th ed.), Russell, Norvig: Ch. 18, “Multiagent Decision Making”.
All books
Labmessage board
How to read this
  • Pick a set-up: one agent, writer plus reviewer, or planner plus two workers. Next message reveals the conversation one message at a time.
  • The tiles count messages and tokens and show whether the final result is correct.
Task: write is_even(n) for integers, including negatives.