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

Staff10 min readFirst readTools & RoutingHierarchical Delegation

After this section you can

  • Route and update state in one return with Command, including from inside a subgraph
  • Choose between sharing and isolating a worker's history, and implement each
  • Pick a router node or a supervisor agent with workers as tools for a given system
38

Subgraphs & the Supervisor

Multi-agent in LangGraph is ordinary graph code. A supervisor is a node that returns where to go next, and a worker is a node or a compiled graph used as a node. What matters is what each worker gets to see.

Key idea

Command lets one node update state and name the next node in the same return, so a supervisor is ordinary code you can test without a model. The real design choice is each worker’s view: the shared message list, or only the task you hand it and the answer it hands back.

A supervisor is a node that returns where to go next; a worker is a node or a whole graph
supervisor returns Command(goto=…) workers hand back here; it routes again or ends billing · subgraph own messages: 6 turns hands back 1 summary shipping · node reads the shared messages appends its reply escalate · node hands the ticket to a person goto="billing" goto="escalate" Shipping reads and writes the one shared messages list. Billing works in its own transcript and hands back one message. Who sees what is the design decision. Routing is a return value.

Related

More in LLM & Agentic

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

Unlock Premium