---
source: https://iinventedlight.com/library/notes/langgraph-subgraphs.md
title: "Nest a compiled LangGraph graph as a subgraph node"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (LangChain Docs); MIT (langchain-ai/langgraph (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: LangChain Docs, Subgraphs; langchain-ai/langgraph (GitHub), LangGraph types (subgraph checkpointing). MIT; MIT."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: agent-operations
topic_area: "agent operations: LangGraph subgraphs"
tags: [langgraph, subgraphs, multi-agent, persistence]
client: Librarian
sources:
  - id: S1
    title: "Subgraphs"
    publisher: LangChain Docs
    url: https://docs.langchain.com/oss/python/langgraph/use-subgraphs.md
    accessed: 2026-11-19
    license: "MIT"
  - id: S2
    title: "LangGraph types (subgraph checkpointing)"
    publisher: langchain-ai/langgraph (GitHub)
    url: https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/types.py
    accessed: 2026-11-19
    license: "MIT"
---
# Nest a compiled LangGraph graph as a subgraph node
**Answer:** A LangGraph subgraph is a graph used as a node in another graph. You compile the inner graph and add it as a node, then define how parent and subgraph state communicate. Stateful subgraphs can inherit the parent checkpointer so interrupts and persistence still work.

## Why subgraphs

This guide explains the mechanics of using subgraphs. A subgraph is a graph that is used as a node in another graph. Subgraphs are useful for building multi-agent systems, reusing a set of nodes in multiple graphs, and distributing development so different teams can work on different parts independently. The subgraph interface is the input and output schemas. If that interface is respected, the parent graph can be built without knowing details of the subgraph. When adding subgraphs, you need to define how the parent graph and the subgraph communicate.

## Persistence in subgraphs

Stateful subgraphs inherit the parent graph's checkpointer, which enables interrupts and persistence. The stateful modes differ in how long state is retained. Use per-thread persistence when a subagent needs multi-turn conversation memory. Use per-invocation persistence when each call is independent and the subagent does not need to remember previous calls. The types module documents the checkpointer setting for a subgraph: True enables persistent checkpointing for this subgraph. It also describes a snapshot of the subgraph state, or None if not a subgraph.

| subgraph | checkpointer |
|---|---|
| subgraph as a node | reuse a compiled graph inside a parent |
| input and output schemas | interface the parent graph relies on |
| per-thread persistence | subagent needs multi-turn memory |
| checkpointer True | persistent checkpointing for the subgraph |

## See also

- [langgraph-checkpoint](https://iinventedlight.com/library/notes/langgraph-checkpoint/)
- [langgraph-interrupt](https://iinventedlight.com/library/notes/langgraph-interrupt/)
- [ao-architecture-cognitive-agents](https://iinventedlight.com/library/notes/ao-architecture-cognitive-agents/)

## Claims

- id: C1
  claim: The LangGraph docs explain the mechanics of using subgraphs.
  source: S1
  evidence: "This guide explains the mechanics of using subgraphs."

- id: C2
  claim: Stateful subgraphs inherit the parent checkpointer, which enables interrupts and persistence.
  source: S1
  evidence: "Stateful subgraphs inherit the parent graph's checkpointer"

- id: C3
  claim: Setting the subgraph checkpointer to True enables persistent checkpointing for that subgraph.
  source: S2
  evidence: "`True` enables persistent checkpointing for this subgraph."

## Sources

- [S1] Subgraphs. LangChain Docs. https://docs.langchain.com/oss/python/langgraph/use-subgraphs.md . License: MIT. Accessed 2026-11-19.

- [S2] LangGraph types (subgraph checkpointing). langchain-ai/langgraph (GitHub). https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/types.py . License: MIT. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: LangChain Docs, Subgraphs; langchain-ai/langgraph (GitHub), LangGraph types (subgraph checkpointing). MIT; MIT. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
