Whetstone.
Advanced AgentMulti-agent systems
Module 2, Lesson 316 min

Multi-agent systems

You already know the runtime for this. A compiled agent is a compiled StateGraph, a graph can be a node inside another graph, and Command routes. Multi-agent is not new machinery, it is a set of decisions about who is holding the conversation.

The patterns, as the documentation names them

  • Subagents. A main agent coordinates specialists as tools. All routing passes through the main agent, which decides when and how to invoke each one.
  • Handoffs. A tool call updates a state variable, and that triggers routing or reconfiguration. Behaviour changes dynamically based on state.
  • Skills. Specialised prompts and knowledge loaded on demand. A single agent stays in control and pulls in context as needed.
  • Router. A classification step directs input to one or more specialised agents, and the results are synthesised into a combined response.
  • Custom workflow. Built directly on LangGraph when none of the four fit.

The distinction that actually matters

Subagents and handoffs look identical on a whiteboard. Both draw a box calling another box.

Handoff, mechanically

A node inside a subgraph routes in the parent graph:

Routing one level up
from langgraph.types import Command

return Command(
    goto="billing_agent",
    update={"messages": [...]},
    graph=Command.PARENT,
)

goto names the destination, update writes state on the way through, and graph=Command.PARENT says resolve that destination in the parent graph rather than in the graph currently executing. Without it, goto looks for a sibling node inside the subgraph and does not find one.

The failure mode worth naming

Multi-agent systems are the most over-reached-for pattern in this whole domain, and the reason is that org charts are a very satisfying way to think about software.

Three specialists with distinct tool sets and genuinely different objectives is a real multi-agent system. Four prompt variants is a skills problem, and building it as four agents means you now own four conversation histories, four sets of context pressure, and a coordination layer, to solve something a loaded prompt would have handled.

The practical test before you split: name the thing the specialist can do that the main agent structurally cannot. If the honest answer is “follow a longer instruction”, you have found a skills problem wearing a multi-agent costume.

Practice

Try it yourself

Quiz

Where control ends up

The single structural difference between the two patterns people mix up most, and it is about control rather than about topology.

  1. ABoth return control to the caller once the specialist has finished its work
  2. BA subagent returns control to the main agent; a handoff transfers it and does not return
  3. CA handoff returns control to the caller; a subagent transfers it and does not return
  4. DNeither returns control; both terminate the run when the specialist replies
Show answer

Correct answer: B — A subagent returns control to the main agent; a handoff transfers it and does not return

A subagent is invoked as a tool, so its result flows back and the main agent decides what happens next. A handoff routes control elsewhere and the receiving agent owns the conversation from that point. The first option is the comfortable answer because both look like delegation on a diagram, and the difference only shows up in who is holding the conversation afterwards.

Quiz

Reading a handoff

What does the graph argument change here?

A handoff from inside a subgraph
return Command(
    goto="billing_agent",
    update={"messages": [...]},
    graph=Command.PARENT,
)
  1. AIt names the graph that gets compiled next, so routing waits for it
  2. BIt restricts the update to the parent's state only, leaving the subgraph state untouched
  3. CIt records the parent graph id for tracing, and has no effect on routing
  4. DIt routes the goto in the parent graph rather than in the graph currently executing
Show answer

Correct answer: D — It routes the goto in the parent graph rather than in the graph currently executing

Command.PARENT tells the runtime to resolve goto one level up, in the parent graph, which is how a node inside a subgraph hands control to a sibling of its own parent. The second option is tempting because the update and the graph argument sit next to each other and look like they must be related; graph is about where routing resolves, not about which state gets written.

Recall

The named patterns

The official material names these as architectures rather than APIs, so the recall that matters is what each one is for, not what to import.

Name the multi-agent patterns the documentation lists, with one clause each on what distinguishes them.

Reveal answer

Subagents, where a main agent coordinates specialists as tools and all routing passes through it. Handoffs, where a tool call updates state and that triggers routing or reconfiguration, so behaviour changes dynamically. Skills, where one agent stays in control and loads specialised prompts and knowledge on demand. Router, where a classification step directs input to one or more specialised agents and the results are synthesised. And custom workflow, built directly on LangGraph when none of the four fit.

Quiz

One agent or several

A single agent needs deep, specialised instructions for four different task types, but no separate tool sets and no separate conversation. Which pattern?

  1. ASkills, loading specialised prompts and knowledge on demand into one agent
  2. BSubagents, one per task type, each with its own prompt and conversation
  3. CA router that classifies the request first and dispatches to a specialist
  4. DHandoffs, transferring control to a different agent per task type
Show answer

Correct answer: A — Skills, loading specialised prompts and knowledge on demand into one agent

When only the instructions differ and control never needs to leave, skills keep one agent in charge and load context on demand. Subagents is the tempting answer because four task types reads as four specialists, but spawning agents to carry four prompt variants pays the whole cost of a multi-agent system to solve a context-loading problem.

Check

Draw one you already run

Take any system you have built or used where one process dispatches work to others, and map it onto the pattern list.

You should see

You named the pattern, and you can say which of the two control behaviours it has, meaning whether control returns to the dispatcher or leaves it.

Sign in to track your progress →