Subgraphs

Use multiple agents as subgraphs in your application.

Sub-Agents

Waking up the demo

This example demonstrates subgraphs in the CopilotKit Feature Viewer.

What are Subgraphs?

If your LangGraph graph uses subgraphs, CopilotKit streams their state and interrupts to your UI like a single graph.

How does CopilotKit support this?

CopilotKit supports streaming directly from subgraphs, so nested graphs can emit events in real time just like a single graph.

Using this feature requires no extra steps on the agent side. All you need to do is subscribe to the agent state in your frontend:

The subgraph nodes will stream as usual, and you can also use interrupt() directly from a subgraph.

How is this guide?