Subgraphs and Multi-Agent OrchestrationA compiled graph is a node
No narration yet
Module 7, Lesson 120 min

A compiled graph is a node

Florence runs your waves with a supervisor-plus-reviewers orchestration (/reviewed-implementation). This module builds a working toy of it in LangGraph: a supervisor dispatching an implementer subgraph and a reviewer subgraph with a fix loop. You understand the pattern from the inside, and you get a template for LangGraph-native agent teams.

Any graph you .compile() can be added into a parent graph exactly like a plain function node. That is the whole mechanism: composition, not a special API.

A compiled subgraph used as a node
const implementer = new StateGraph(ImplState)./*…*/.compile();
const reviewer    = new StateGraph(ReviewState)./*…*/.compile();

const supervisor = new StateGraph(SupervisorState)
  .addNode("implement", implementer)
  .addNode("review", reviewer)
  .addNode("route", routeNode)
  .addEdge(START, "route")
  .compile();

State mapping between parent and child: the subgraph has its own state schema. When the parent invokes it, matching keys flow in and out; keys the subgraph does not declare stay isolated in the parent. This is the important safety property: the implementer's scratch state does not leak into the reviewer's, and neither pollutes the supervisor's.

Practice

Try it yourself

Recall

What compiled-graph-as-node tells you

A compiled graph becomes a node with no special wrapper. Let that constrain the answer.

How does the parent graph's state get into a compiled-subgraph node?