# langchain-ai/langgraph architecture

> Architecture diagram of the GitHub repository langchain-ai/langgraph, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/langchain-ai/langgraph
- Repository: https://github.com/langchain-ai/langgraph
- Video tour (about a minute): https://gitdiagram.com/langchain-ai/langgraph/video

## Overview

LangGraph is a low-level framework for defining and running stateful agent workflows. A developer defines a graph, then invokes it; the Pregel runtime schedules node work and exposes results or streams. Checkpointing supports durable execution and resumption, while stores provide longer-term memory; interrupts enable human oversight. The repository also includes prebuilt agent/tool components, a Python client for a LangGraph API, and a CLI for deployment. Arrows are limited to relationships stated in the README or shown by the supplied excerpts and source index; unsampled integrations are not inferred.

Main entry points: [`libs/langgraph/langgraph/pregel/main.py`](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/pregel/main.py) (Pregel engine), [`libs/sdk-py/langgraph_sdk/_async/client.py`](https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/client.py) (Async SDK client), [`libs/langgraph/langgraph/graph/state.py`](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/graph/state.py) (State graph), [`libs/langgraph/langgraph/types.py`](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/types.py) (Interrupt controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Graph workflow"]
  node_state_graph["State graph<br/>[state.py]"]
  node_interrupts["Interrupt controls<br/>[types.py]"]
end

subgraph group_runtime["Execution runtime"]
  node_pregel["Pregel engine<br/>[main.py]"]
  node_runnable["Runnable execution<br/>[_runnable.py]"]
  node_runtime_context["Runtime context<br/>[runtime.py]"]
  node_channels["State channels<br/>[base.py]"]
  node_streaming["Stream transformation<br/>[transformers.py]"]
end

subgraph group_persistence["Persistence and memory"]
  node_checkpoint_api["Checkpoint interface<br/>[__init__.py]"]
  node_serializer["JSON-plus serializer<br/>[jsonplus.py]"]
  node_memory_store["Memory store<br/>[__init__.py]"]
  node_memory_backend["In-memory store<br/>[__init__.py]"]
  node_postgres_checkpoint[("Postgres checkpoints<br/>[shallow.py]")]
  node_sqlite_checkpoint[("SQLite checkpoints<br/>[aio.py]")]
end

subgraph group_interfaces["Agent and client interfaces"]
  node_tool_node["Tool execution<br/>[tool_node.py]"]
  node_chat_agent["Chat agent"]
  node_sdk_async["Async SDK client<br/>[client.py]"]
  node_sdk_sync["Sync SDK client<br/>[client.py]"]
  node_sdk_runs["Run operations<br/>[runs.py]"]
  node_sdk_threads["Thread operations<br/>[threads.py]"]
end

subgraph group_operations["Deployment"]
  node_cli_config["App configuration<br/>[config.py]"]
  node_cli_deploy["Deployment workflow<br/>[deploy.py]"]
end

node_developer(("Workflow developer"))
node_api_service["LangGraph API"]
node_human(("Human reviewer"))
node_persistent_storage[("Persistent storage")]

node_developer -->|"defines workflow"| node_state_graph
node_state_graph -->|"compiles graph"| node_pregel
node_pregel -->|"executes nodes"| node_runnable
node_pregel -->|"uses channels"| node_channels
node_pregel -->|"uses checkpoint"| node_checkpoint_api
node_pregel -->|"uses store"| node_memory_store
node_pregel -.->|"emits streams"| node_streaming
node_runnable -->|"provides context"| node_runtime_context
node_tool_node -->|"uses runtime"| node_runtime_context
node_chat_agent -.->|"dispatches tools"| node_tool_node
node_human -->|"provides response"| node_interrupts
node_interrupts -.->|"pauses execution"| node_pregel
node_checkpoint_api -->|"serializes state"| node_serializer
node_memory_backend -->|"implements store"| node_memory_store
node_postgres_checkpoint -.->|"reads and writes"| node_persistent_storage
node_sqlite_checkpoint -.->|"reads and writes"| node_persistent_storage
node_sdk_async -->|"exposes runs"| node_sdk_runs
node_sdk_async -->|"exposes threads"| node_sdk_threads
node_sdk_sync -.->|"sends requests"| node_api_service
node_sdk_async -.->|"sends requests"| node_api_service
node_sdk_runs -.->|"manages runs"| node_api_service
node_sdk_threads -.->|"manages threads"| node_api_service
node_cli_config -->|"configures deployment"| node_cli_deploy
node_cli_deploy -->|"deploys application"| node_api_service

click node_state_graph "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/graph/state.py"
click node_pregel "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/pregel/main.py"
click node_runnable "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/_internal/_runnable.py"
click node_runtime_context "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/runtime.py"
click node_channels "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/channels/base.py"
click node_streaming "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/stream/transformers.py"
click node_interrupts "https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/types.py"
click node_tool_node "https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_node.py"
click node_chat_agent "https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py"
click node_checkpoint_api "https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/base/__init__.py"
click node_serializer "https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py"
click node_memory_store "https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/store/base/__init__.py"
click node_memory_backend "https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/store/memory/__init__.py"
click node_postgres_checkpoint "https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py"
click node_sqlite_checkpoint "https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py"
click node_sdk_async "https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/client.py"
click node_sdk_sync "https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_sync/client.py"
click node_sdk_runs "https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/runs.py"
click node_sdk_threads "https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/threads.py"
click node_cli_config "https://github.com/langchain-ai/langgraph/blob/main/libs/cli/langgraph_cli/config.py"
click node_cli_deploy "https://github.com/langchain-ai/langgraph/blob/main/libs/cli/langgraph_cli/deploy.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_state_graph,node_interrupts,node_human toneBlue
class node_pregel,node_runnable,node_runtime_context,node_channels,node_streaming,node_persistent_storage toneAmber
class node_checkpoint_api,node_serializer,node_memory_store,node_memory_backend,node_postgres_checkpoint,node_sqlite_checkpoint,node_api_service toneMint
class node_tool_node,node_chat_agent,node_sdk_async,node_sdk_sync,node_sdk_runs,node_sdk_threads toneRose
class node_cli_config,node_cli_deploy,node_developer toneIndigo
```

## Components

### Graph workflow

- [State graph](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/graph/state.py): `libs/langgraph/langgraph/graph/state.py`
- [Interrupt controls](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/types.py): `libs/langgraph/langgraph/types.py`

### Execution runtime

- [Pregel engine](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/pregel/main.py): `libs/langgraph/langgraph/pregel/main.py`
- [Runnable execution](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/_internal/_runnable.py): `libs/langgraph/langgraph/_internal/_runnable.py`
- [Runtime context](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/runtime.py): `libs/langgraph/langgraph/runtime.py`
- [State channels](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/channels/base.py): `libs/langgraph/langgraph/channels/base.py`
- [Stream transformation](https://github.com/langchain-ai/langgraph/blob/main/libs/langgraph/langgraph/stream/transformers.py): `libs/langgraph/langgraph/stream/transformers.py`

### Persistence and memory

- [Checkpoint interface](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/base/__init__.py): `libs/checkpoint/langgraph/checkpoint/base/__init__.py`
- [JSON-plus serializer](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py): `libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py`
- [Memory store](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/store/base/__init__.py): `libs/checkpoint/langgraph/store/base/__init__.py`
- [In-memory store](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint/langgraph/store/memory/__init__.py): `libs/checkpoint/langgraph/store/memory/__init__.py`
- [Postgres checkpoints](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py): `libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py`
- [SQLite checkpoints](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py): `libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py`

### Agent and client interfaces

- [Tool execution](https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_node.py): `libs/prebuilt/langgraph/prebuilt/tool_node.py`
- [Chat agent](https://github.com/langchain-ai/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py): `libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py`
- [Async SDK client](https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/client.py): `libs/sdk-py/langgraph_sdk/_async/client.py`
- [Sync SDK client](https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_sync/client.py): `libs/sdk-py/langgraph_sdk/_sync/client.py`
- [Run operations](https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/runs.py): `libs/sdk-py/langgraph_sdk/_async/runs.py`
- [Thread operations](https://github.com/langchain-ai/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/threads.py): `libs/sdk-py/langgraph_sdk/_async/threads.py`

### Deployment

- [App configuration](https://github.com/langchain-ai/langgraph/blob/main/libs/cli/langgraph_cli/config.py): `libs/cli/langgraph_cli/config.py`
- [Deployment workflow](https://github.com/langchain-ai/langgraph/blob/main/libs/cli/langgraph_cli/deploy.py): `libs/cli/langgraph_cli/deploy.py`

### Other components

- **Workflow developer**
- **LangGraph API**
- **Human reviewer**
- **Persistent storage**

## Connections

- Workflow developer → State graph: defines workflow (evidence: `README.md`)
- State graph → Pregel engine: compiles graph (evidence: `libs/langgraph/langgraph/graph/state.py`)
- Pregel engine → Runnable execution: executes nodes (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel engine → State channels: uses channels (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel engine → Checkpoint interface: uses checkpoint (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel engine → Memory store: uses store (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel engine → Stream transformation: emits streams
- Runnable execution → Runtime context: provides context (evidence: `libs/langgraph/langgraph/_internal/_runnable.py`)
- Tool execution → Runtime context: uses runtime (evidence: `libs/prebuilt/langgraph/prebuilt/tool_node.py`)
- Chat agent → Tool execution: dispatches tools
- Human reviewer → Interrupt controls: provides response (evidence: `README.md`)
- Interrupt controls → Pregel engine: pauses execution
- Checkpoint interface → JSON-plus serializer: serializes state (evidence: `libs/checkpoint/langgraph/checkpoint/base/__init__.py`)
- In-memory store → Memory store: implements store (evidence: `libs/checkpoint/langgraph/store/base/__init__.py`)
- Postgres checkpoints → Persistent storage: reads and writes
- SQLite checkpoints → Persistent storage: reads and writes
- Async SDK client → Run operations: exposes runs (evidence: `libs/sdk-py/langgraph_sdk/_async/client.py`)
- Async SDK client → Thread operations: exposes threads (evidence: `libs/sdk-py/langgraph_sdk/_async/client.py`)
- Sync SDK client → LangGraph API: sends requests
- Async SDK client → LangGraph API: sends requests
- Run operations → LangGraph API: manages runs
- Thread operations → LangGraph API: manages threads
- App configuration → Deployment workflow: configures deployment (evidence: `libs/cli/langgraph_cli/deploy.py`)
- Deployment workflow → LangGraph API: deploys application (evidence: `README.md`)
