# Subgraphs

> Use multiple agents as subgraphs in your application.

<IframeSwitcher
  id="subgraphs-example"
  exampleUrl="https://feature-viewer.copilotkit.ai/langgraph/feature/subgraphs?sidebar=false&chatDefaultOpen=false"
  codeUrl="https://feature-viewer.copilotkit.ai/langgraph/feature/subgraphs?view=code&sidebar=false&codeLayout=tabs"
  exampleLabel="Demo"
  codeLabel="Code"
  height="700px"
/>

<Callout type="info">
  This example demonstrates subgraphs in the [CopilotKit Feature
  Viewer](https://feature-viewer.copilotkit.ai/langgraph/feature/subgraphs).
</Callout>

## What are Subgraphs? [#what-are-subgraphs]

If your LangGraph graph uses [subgraphs](https://docs.langchain.com/oss/python/langgraph/use-subgraphs), CopilotKit streams their state and interrupts to your UI like a single graph.

## How does CopilotKit support this? [#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.
