Skip to main content
Subgraphs let you break complex agent logic into reusable, composable pieces. A parent graph can invoke another compiled graph as a node, and Aegra handles state management, streaming, and interrupts transparently across the boundary.

Basic composition

Add a compiled graph as a node in another graph:
Register the parent graph in aegra.json:

Streaming subgraph events

By default, streaming only includes events from the top-level graph. To include subgraph events:

Interrupts in subgraphs

Interrupts work transparently across subgraph boundaries. If a subgraph calls interrupt(), the parent run pauses and the client receives the interrupt payload. Resuming the run continues execution inside the subgraph.
The client-side flow is identical to interrupts in a top-level graph. See the human-in-the-loop guide.

Inspecting subgraphs

Use the assistant API to explore subgraph structure:

State and checkpoints

Subgraph state is stored within the parent graph’s checkpoints. When you inspect thread state, subgraph checkpoints are available via the checkpoint_ns parameter:

Example: orchestrator pattern

A common pattern is a coordinator that delegates to specialized subgraphs: