LangGraph from the ground up
Workflows that loop, pause and resume
- Advanced
- 10 chapters
- 162 min read
State machines for AI workflows: a shared state, nodes as functions, conditional edges that route, loops with a cap, checkpoints that survive a crash, interrupts for human approval and a supervisor that routes between specialists. Every mechanism is built once in plain Python before the framework appears.
What You'll Learn
- Explain when a workflow needs a graph instead of a chain
- Design a state and choose reducers for each key
- Wire nodes and edges, including an explicit entry point
- Route conditionally and bound a loop with a cap
- Save checkpoints and resume a run after a failure
- Pause before an irreversible action and resume with a decision
- Route between specialist agents with a supervisor
- Build a writer-critic graph with approval and a revision limit
Prerequisites
- Comfortable with Python functions, dictionaries and classes
- The LangChain course is good preparation for the node and state ideas
- No API key is needed — the examples run on plain Python
Vocabulary
The terms the chapters assume, in plain words.
- checkpoint
- A saved copy of the state after a step, stored under a thread so a run can resume or rewind.
- compile
- The step that checks a graph's connections and turns it into something that can be run.
- conditional edge
- A rule that reads the state and names which node runs next.
- edge
- A rule saying which node runs after the current one finishes.
- entry point
- The declared first node of a graph, marked by an edge from the start.
- graph
- A workflow drawn as nodes joined by edges, where the path can branch and loop.
- interrupt
- A planned pause before a node runs, so a person can approve, reject or edit first.
- node
- A function that reads the state and returns only the keys it changed.
- reducer
- A function that decides how an update is combined with the old value of one state key.
- state
- The shared record passed between nodes, holding every value the workflow needs to continue.
- subgraph
- A graph mounted inside another as a single node, with its own slice of state.
- supervisor
- A node that reads the state and chooses which specialist worker runs next, rather than answering itself.
- thread
- A named run whose checkpoints are stored together, so it can be listed, resumed or branched.
Course Content
- 01Graphs, not chainsNot started
A chain runs once from left to right. A graph has a state, named steps, and the ability to go back — which is what real workflows need.
- 02State and reducersNot started
A node does not replace the state, it returns an update. Whether that update overwrites or appends is decided by a reducer — and that choice explains most graph bugs.
- 03Nodes and edgesNot started
A node is a function of the state. An edge is a rule about which node runs next. Everything else in a graph is built from those two things.
- 04Conditional edges and loopsNot started
A router function reads the state and names the next node. Point it back at an earlier node and the graph loops — which is powerful, and needs a stop condition.
- 05Checkpoints and resumptionNot started
A checkpoint is the state after every step, saved under a thread id. It turns a crashed run into something you can continue, and a finished run into something you can rewind.
- 06Human in the loopNot started
A graph can pause before a step, hand the state to a person, and continue with their decision. The pause is a checkpoint; the decision is just another update.
- 07Multi-agent patternsNot started
Several specialists, one router. The supervisor reads the state, picks a worker, and takes the result back — a graph whose nodes happen to be agents.
- 08Subgraphs and compositionNot started
A compiled graph is a callable, so it can be a node. Subgraphs keep a large workflow readable, as long as the state contract at the boundary is small, explicit and tested.
- 09Durability in productionNot started
A checkpoint survives a crash; it does not make a side effect happen once. Idempotency keys, retry policies, a lease per thread and a state migration are what turn resumption into durability.
- 10Capstone: a writer-critic graphNot started
A draft, a critique, a revision loop with a cap, a checkpoint after every step, and an approval before anything is published. Every idea in the course, once.
