# taohaoran/langgraph architecture

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

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

## Overview

LangGraph is a framework for defining and running stateful agent workflows. A developer builds a state graph; the Pregel runtime executes its nodes over channels, with runnable support and streaming for execution behavior and results. Checkpointers, serialization, and stores support durable execution and memory; prebuilt components provide common agent and tool patterns. The Python SDK exposes remote assistant, thread, and run operations, while the CLI supports deployment. The README describes the major product capabilities; connections involving unsampled implementations are omitted or marked unverified.

Main entry points: [`libs/langgraph/langgraph/pregel/main.py`](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/pregel/main.py) (Pregel runtime), [`libs/langgraph/langgraph/graph/state.py`](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/graph/state.py) (State graph), [`libs/sdk-py/langgraph_sdk/_async/client.py`](https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/client.py) (Python SDK), [`libs/checkpoint/langgraph/checkpoint/base/__init__.py`](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/base/__init__.py) (Checkpoint interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow runtime"]
  node_stategraph["State graph<br/>[state.py]"]
  node_pregel["Pregel runtime<br/>[main.py]"]
  node_channels["State channels<br/>[base.py]"]
  node_runnable["Runnable execution<br/>[_runnable.py]"]
  node_streaming["Stream transforms<br/>[transformers.py]"]
end

subgraph group_agent["Agent components"]
  node_agentbuilder["Chat agent"]
  node_tools["Tool execution<br/>[tool_node.py]"]
end

subgraph group_state["State and memory"]
  node_checkpointer["Checkpoint interface<br/>[__init__.py]"]
  node_serializer["JSON serialization<br/>[jsonplus.py]"]
  node_store["Memory store<br/>[__init__.py]"]
  node_memory["In-memory store<br/>[__init__.py]"]
  node_postgres[("Postgres storage<br/>[base.py]")]
  node_sqlite[("SQLite checkpoint<br/>[aio.py]")]
  node_cache["Cache interface<br/>[__init__.py]"]
end

subgraph group_access["Client access"]
  node_sdk["Python SDK<br/>[client.py]"]
  node_runs["Run operations<br/>[runs.py]"]
  node_threads["Thread operations<br/>[threads.py]"]
end

subgraph group_operations["Deployment"]
  node_deployment["CLI deployment<br/>[deploy.py]"]
end

node_developer(("Developer"))
node_human(("Human reviewer"))

node_developer -->|"defines workflow"| node_stategraph
node_stategraph -.->|"compiles graph"| node_pregel
node_pregel -->|"updates state"| node_channels
node_pregel -->|"loads checkpoints"| node_checkpointer
node_pregel -.->|"serializes state"| node_serializer
node_pregel -->|"executes nodes"| node_runnable
node_pregel -.->|"emits streams"| node_streaming
node_agentbuilder -->|"uses tools"| node_tools
node_agentbuilder -.->|"builds workflow"| node_stategraph
node_pregel -->|"accesses memory"| node_store
node_store -->|"implemented by"| node_memory
node_store -->|"implemented by"| node_postgres
node_checkpointer -.->|"implemented by"| node_postgres
node_checkpointer -.->|"implemented by"| node_sqlite
node_stategraph -->|"supports caching"| node_cache
node_sdk -->|"provides operations"| node_runs
node_sdk -->|"provides operations"| node_threads
node_sdk -.->|"invokes remotely"| node_pregel
node_human -.->|"reviews state"| node_pregel
node_developer -->|"deploys workflow"| node_deployment

click node_stategraph "https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/graph/state.py"
click node_pregel "https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/pregel/main.py"
click node_channels "https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/channels/base.py"
click node_runnable "https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/_internal/_runnable.py"
click node_streaming "https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/stream/transformers.py"
click node_agentbuilder "https://github.com/taohaoran/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py"
click node_tools "https://github.com/taohaoran/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_node.py"
click node_checkpointer "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/base/__init__.py"
click node_serializer "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py"
click node_store "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/store/base/__init__.py"
click node_memory "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/store/memory/__init__.py"
click node_postgres "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py"
click node_sqlite "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py"
click node_cache "https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/cache/base/__init__.py"
click node_sdk "https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/client.py"
click node_runs "https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/runs.py"
click node_threads "https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/threads.py"
click node_deployment "https://github.com/taohaoran/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_stategraph,node_pregel,node_channels,node_runnable,node_streaming,node_human toneBlue
class node_agentbuilder,node_tools toneAmber
class node_checkpointer,node_serializer,node_store,node_memory,node_postgres,node_sqlite,node_cache toneMint
class node_sdk,node_runs,node_threads toneRose
class node_deployment,node_developer toneIndigo
```

## Components

### Workflow runtime

- [State graph](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/graph/state.py): `libs/langgraph/langgraph/graph/state.py`
- [Pregel runtime](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/pregel/main.py): `libs/langgraph/langgraph/pregel/main.py`
- [State channels](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/channels/base.py): `libs/langgraph/langgraph/channels/base.py`
- [Runnable execution](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/_internal/_runnable.py): `libs/langgraph/langgraph/_internal/_runnable.py`
- [Stream transforms](https://github.com/taohaoran/langgraph/blob/main/libs/langgraph/langgraph/stream/transformers.py): `libs/langgraph/langgraph/stream/transformers.py`

### Agent components

- [Chat agent](https://github.com/taohaoran/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py): `libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py`
- [Tool execution](https://github.com/taohaoran/langgraph/blob/main/libs/prebuilt/langgraph/prebuilt/tool_node.py): `libs/prebuilt/langgraph/prebuilt/tool_node.py`

### State and memory

- [Checkpoint interface](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/base/__init__.py): `libs/checkpoint/langgraph/checkpoint/base/__init__.py`
- [JSON serialization](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py): `libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py`
- [Memory store](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/store/base/__init__.py): `libs/checkpoint/langgraph/store/base/__init__.py`
- [In-memory store](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/store/memory/__init__.py): `libs/checkpoint/langgraph/store/memory/__init__.py`
- [Postgres storage](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py): `libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py`
- [SQLite checkpoint](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py): `libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py`
- [Cache interface](https://github.com/taohaoran/langgraph/blob/main/libs/checkpoint/langgraph/cache/base/__init__.py): `libs/checkpoint/langgraph/cache/base/__init__.py`

### Client access

- [Python SDK](https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/client.py): `libs/sdk-py/langgraph_sdk/_async/client.py`
- [Run operations](https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/runs.py): `libs/sdk-py/langgraph_sdk/_async/runs.py`
- [Thread operations](https://github.com/taohaoran/langgraph/blob/main/libs/sdk-py/langgraph_sdk/_async/threads.py): `libs/sdk-py/langgraph_sdk/_async/threads.py`

### Deployment

- [CLI deployment](https://github.com/taohaoran/langgraph/blob/main/libs/cli/langgraph_cli/deploy.py): `libs/cli/langgraph_cli/deploy.py`

### Other components

- **Developer**
- **Human reviewer**

## Connections

- Developer → State graph: defines workflow
- State graph → Pregel runtime: compiles graph
- Pregel runtime → State channels: updates state (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel runtime → Checkpoint interface: loads checkpoints (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel runtime → JSON serialization: serializes state
- Pregel runtime → Runnable execution: executes nodes (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Pregel runtime → Stream transforms: emits streams (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Chat agent → Tool execution: uses tools (evidence: `libs/prebuilt/langgraph/prebuilt/tool_node.py`)
- Chat agent → State graph: builds workflow
- Pregel runtime → Memory store: accesses memory (evidence: `libs/langgraph/langgraph/pregel/main.py`)
- Memory store → In-memory store: implemented by (evidence: `libs/checkpoint/langgraph/store/base/__init__.py`)
- Memory store → Postgres storage: implemented by
- Checkpoint interface → Postgres storage: implemented by
- Checkpoint interface → SQLite checkpoint: implemented by (evidence: `libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py`)
- State graph → Cache interface: supports caching (evidence: `libs/langgraph/langgraph/graph/state.py`)
- Python SDK → Run operations: provides operations (evidence: `libs/sdk-py/langgraph_sdk/_async/client.py`)
- Python SDK → Thread operations: provides operations (evidence: `libs/sdk-py/langgraph_sdk/_async/client.py`)
- Python SDK → Pregel runtime: invokes remotely
- Human reviewer → Pregel runtime: reviews state
- Developer → CLI deployment: deploys workflow
