Low-level runtime for stateful agents · graphs · checkpoints · human-in-the-loop · verified against LangGraph 1.x (2026)

LangGraph cheat sheet

LangGraph is the durable, stateful runtime under LangChain's agents. You model an app as a graph: a typed state, nodes (functions that update it), and edges (which node runs next). A checkpointer saves state after every step — giving you memory, streaming, human-in-the-loop pauses, and time travel for free. Reach for LangGraph when the single create_agent loop isn't enough: branching, cycles, and multi-agent control. Targets langgraph 1.x, Python 3.10+.

graph core state & messages control flow persistence & HITL streaming & ecosystem gotcha most common

Verified 2026-08-31 against the official docs at langchain-ai.github.io/langgraph and reference.langchain.com (LangGraph 1.x; GA Oct 2025). LangChain's create_agent compiles to a LangGraph graph — this sheet is the layer beneath it.

Outline

Learn the graph triple — state, nodes, edges — then layer on routing, persistence, human-in-the-loop, and streaming.

Getting started

  1. 1Install & imports
  2. 2Build & run a graph

State

  1. 3State schema & reducers
  2. 4Messages & MessagesState

Control flow

  1. 5Edges & conditional routing
  2. 6Command — dynamic control
  3. 7Send — map-reduce

Persistence & HITL

  1. 8Checkpointer & threads
  2. 9Human-in-the-loop
  3. 10Time travel & durability

Streaming & ecosystem

  1. 11Streaming
  2. 12Prebuilt: ToolNode & agents
  3. 13Store, deploy & ecosystem

Getting Started

Install, then assemble the graph triple: state, nodes, edges, compile.

1Install & importspip / packages
2Build & run a graphthe whole loop

State

State is the single source of truth; reducers decide how each update merges in.

3State schema & reducershow updates merge
4Messages & MessagesStatechat state

Control Flow

Static edges, data-dependent routing, and dynamic jumps — including fan-out map-reduce.

5Edges & conditional routingwho runs next
6Command — dynamic controlupdate + goto
7Send — map-reducefan-out

Persistence & Human-in-the-Loop

Checkpoints give memory across turns, pause/resume for approvals, and time travel.

8Checkpointer & threadsdurable memory
9Human-in-the-looppause for a human
10Time travel & durabilityrewind / replay

Streaming & Ecosystem

Stream progress and tokens, reuse prebuilt components, and deploy.

11Streamingwatch it run
12Prebuilt: ToolNode & agentsdon't reinvent
13Store, deploy & ecosystemship it

Worth memorizing

graph triplestate (TypedDict) + nodes + edges
nodestate -> partial-state dict (merged in)
Annotated + reduceradd_messages / operator.add = append
START / ENDentry & exit sentinels
conditional_edgesrouter returns next node name(s)
cycletools -> agent back-edge = the agent loop
Commandupdate state + goto in one return
Sendfan-out N parallel node copies (map-reduce)
checkpointercompile(checkpointer=) + thread_id = memory
interrupt()pause; resume with Command(resume=...)
stream_modeupdates / values / messages / custom
ToolNode+ tools_condition = prebuilt agent loop