Glossary & resources
源码版本1.2.9
Core terminology
| Term | English | Notes |
|---|---|---|
| State graph | StateGraph | User-facing construction entry point. add_node / add_edge / add_conditional_edges / compile. libs/langgraph/langgraph/graph/state.py |
| Compiled graph | CompiledGraph / Pregel | The product of StateGraph.compile(). Implements PregelProtocol and carries the stream / invoke / astream entry points. libs/langgraph/langgraph/pregel/main.py |
| Pregel executable | Pregel | The compiled executable graph. Inherits PregelProtocol and holds nodes / channels / checkpointer. libs/langgraph/langgraph/pregel/main.py |
| Superstep | superstep | The unit of execution in the Pregel model. Within one superstep, all triggered nodes run concurrently; channel updates are synchronized at the step boundary. Borrowed from the BSP model in Google's Pregel paper. |
| Channel | channel | The state-update primitive. Each channel has a version number, and a reducer decides how writes are merged. libs/langgraph/langgraph/channels/ |
| Channel base | BaseChannel | Abstract base class for all channels. Defines update / get / checkpoint and related interfaces. libs/langgraph/langgraph/channels/base.py |
| LastValue channel | LastValue | A channel that keeps only the latest value, commonly used for state fields. LastValueAfterFinish defers the update until the step finishes. libs/langgraph/langgraph/channels/last_value.py |
| Reducer | reducer | A function that merges writes into a channel — e.g. operator.add for list append. Declared in the state schema via Annotated[T, reducer]. |
| Node | node / PregelNode | The execution unit of a graph. Holds bound / triggers / writers / subgraphs. libs/langgraph/langgraph/pregel/_read.py |
| add_node | add_node | StateGraph.add_node(name, action) registers a node function or Runnable, internally going through coerce_to_runnable. libs/langgraph/langgraph/graph/state.py |
| Conditional edge | add_conditional_edges | Routes to the next node based on the return value of a condition function. Returning a list of Send implements fan-out. libs/langgraph/langgraph/graph/state.py |
| Checkpoint | checkpoint | A thread-level persistence snapshot that records channel versions, pending writes, and metadata, enabling resume from a breakpoint. libs/langgraph/langgraph/pregel/_checkpoint.py |
| Checkpoint saver | BaseCheckpointSaver | The checkpoint persistence interface: put / get_tuple / list. libs/checkpoint/langgraph/checkpoint/base/__init__.py |
| In-memory saver | InMemorySaver / MemorySaver | The in-memory implementation of BaseCheckpointSaver, intended for debugging only. MemorySaver is a legacy alias for InMemorySaver. libs/checkpoint/langgraph/checkpoint/memory/__init__.py |
| State snapshot | StateSnapshot | The state view at the start of a step. Includes values / next / tasks / interrupts. libs/langgraph/langgraph/types.py |
| Interrupt | interrupt / Interrupt | Calling interrupt(value) inside a node raises GraphInterrupt and pauses graph execution. The client resumes it with Command(resume=...). libs/langgraph/langgraph/types.py |
| Command | Command | A three-in-one primitive for resume / goto / update. Can be used either as a node return value or as input to invoke. libs/langgraph/langgraph/types.py |
| Send | Send | The PUSH task primitive: delivers a task with a specific arg to a target node, enabling map-reduce fan-out. libs/langgraph/langgraph/types.py |
| Functional API | @entrypoint / @task | The functional API. @entrypoint wraps a function into a Pregel, and @task wraps a function into a schedulable subtask. libs/langgraph/langgraph/func/__init__.py |
| Stream mode | stream_mode | Output projection option for Pregel.stream / astream: values / updates / messages / custom / checkpoints / tasks / debug. libs/langgraph/langgraph/pregel/main.py |
Directory conventions
- The main source lives in
libs/langgraph/langgraph/, split by responsibility:pregel/— execution engine core.main.pyis thePregelclass entry point;__init__.pyexports the public interface;_loop.pyis thePregelLoopstate machine;_runner.pyis thePregelRunnerconcurrent executor;_algo.pyholdsapply_writes/prepare_next_tasks/should_interruptand other algorithm functions;_io.pyismap_command/map_input/map_output_*;_call.pyisSyncAsyncFutureand the Runnable wrapper for tasks;_read.pyisPregelNode;_executor.pyisBackgroundExecutor/AsyncBackgroundExecutor;remote.pyisRemoteGraph.graph/—StateGraph/CompiledStateGraphuser interface.state.pyis the core;_node.py/_branch.pyare helpers.channels/— channel implementations:BaseChannel/LastValue/Topic/Binopand others.func/— the@entrypoint/@taskfunctional API (all of it actually lives in a single file,func/__init__.py).types.py— public data types:Command/Send/Interrupt/StateSnapshot/PregelExecutableTaskand others.stream/— streaming mux implementation:GraphRunStream/StreamMuxand friends.managed/— runtime-injected values such asIsLastStep.
- Checkpoint implementations are split into standalone packages:
libs/checkpoint/(base + memory),libs/checkpoint-sqlite/,libs/checkpoint-postgres/. - The Pregel engine entry point is
libs/langgraph/langgraph/pregel/__init__.py; the mainPregelclass lives inpregel/main.py.
Official resources
- LangGraph official docs
- LangGraph tutorials
- LangGraph streaming guide
- LangGraph human-in-the-loop guide
- GitHub repo langchain-ai/langgraph (source on this site is pinned to tag
1.2.9)
Source version
The source on this site is pinned to 1.2.9; line numbers refer to that tag. All <SrcLink> URLs point to github.com/langchain-ai/langgraph/blob/1.2.9/<path>#Lxx-Lyy. To bump the version, update LANGGRAPH_TAG in docs/.vitepress/site.ts and run npm run check:refs.