How langchain-ai/langgraph works
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: main.py Pregel engine · client.py Async SDK client · state.py State graph · types.py Interrupt controls
Components 25
Graph workflow
- State graph
libs/langgraph/langgraph/graph/state.py - Interrupt controls
libs/langgraph/langgraph/types.py
Execution runtime
- Pregel engine
libs/langgraph/langgraph/pregel/main.py - Runnable execution
libs/langgraph/langgraph/_internal/_runnable.py - Runtime context
libs/langgraph/langgraph/runtime.py - State channels
libs/langgraph/langgraph/channels/base.py - Stream transformation
libs/langgraph/langgraph/stream/transformers.py
Persistence and memory
- Checkpoint interface
libs/checkpoint/langgraph/checkpoint/base/__init__.py - JSON-plus serializer
libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py - Memory store
libs/checkpoint/langgraph/store/base/__init__.py - In-memory store
libs/checkpoint/langgraph/store/memory/__init__.py - Postgres checkpoints
libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py - SQLite checkpoints
libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py
Agent and client interfaces
- Tool execution
libs/prebuilt/langgraph/prebuilt/tool_node.py - Chat agent
libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py - Async SDK client
libs/sdk-py/langgraph_sdk/_async/client.py - Sync SDK client
libs/sdk-py/langgraph_sdk/_sync/client.py - Run operations
libs/sdk-py/langgraph_sdk/_async/runs.py - Thread operations
libs/sdk-py/langgraph_sdk/_async/threads.py
Deployment
- App configuration
libs/cli/langgraph_cli/config.py - Deployment workflow
libs/cli/langgraph_cli/deploy.py
Other components
- Workflow developer
- LangGraph API
- Human reviewer
- Persistent storage
Connections 24
- Workflow developer → State graph: defines workflow
README.md - State graph → Pregel engine: compiles graph
libs/langgraph/langgraph/graph/state.py - Pregel engine → Runnable execution: executes nodes
libs/langgraph/langgraph/pregel/main.py - Pregel engine → State channels: uses channels
libs/langgraph/langgraph/pregel/main.py - Pregel engine → Checkpoint interface: uses checkpoint
libs/langgraph/langgraph/pregel/main.py - Pregel engine → Memory store: uses store
libs/langgraph/langgraph/pregel/main.py - Pregel engine → Stream transformation: emits streams
- Runnable execution → Runtime context: provides context
libs/langgraph/langgraph/_internal/_runnable.py - Tool execution → Runtime context: uses runtime
libs/prebuilt/langgraph/prebuilt/tool_node.py - Chat agent → Tool execution: dispatches tools
- Human reviewer → Interrupt controls: provides response
README.md - Interrupt controls → Pregel engine: pauses execution
- Checkpoint interface → JSON-plus serializer: serializes state
libs/checkpoint/langgraph/checkpoint/base/__init__.py - In-memory store → Memory store: implements store
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
libs/sdk-py/langgraph_sdk/_async/client.py - Async SDK client → Thread operations: exposes threads
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
libs/cli/langgraph_cli/deploy.py - Deployment workflow → LangGraph API: deploys application
README.md