1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Subgraphs & the Supervisor

Multi-agent LangGraph: routing and updating state in one Command return, using a compiled graph as a node, and choosing between shared and isolated history for a worker.

Last updated

After this section you can

  • Route and update state in one return with Command
  • Use a compiled graph as a node, and translate between mismatched state schemas
  • Decide between shared and isolated history for a worker
05

Subgraphs & the Supervisor

Multi-agent in LangGraph is not a special mode. A supervisor is a node that returns where to go next, and a sub-agent is a compiled graph used as a node.

THE CENTRAL IDEA

Command lets one node do both jobs at once: update the state and name the next node. Once routing is a return value rather than a static edge, a supervisor is ordinary code — and testable without a model.

The supervisor is a node that returns a destination — not a framework feature
supervisor returns Command(goto=…) billing refund, invoice, plan change 3 tools shipping track, reroute, reship 2 tools escalate hand to a person, with context 0 tools result appended, route again — or Command(goto=END) Every worker reads the same messages list, so handing off costs nothing — there is no payload to marshal between them. That is also the limit: one shared history means one context window. Isolate a worker with a subgraph when its transcript is its own business.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium