Backcover

LangGraph
in Small
Pieces
Build the machine
first. Then let the
model decide.

LangGraph is the low-level framework for wiring language models into graphs you control. This book builds an agent one part at a time — a state, a node, an edge, a loop — until you can see exactly where the model's decisions enter and where your code keeps the guardrails.

Every chapter is built around a single runnable example. You can read the code on the page, but you are meant to run it, break it, and watch what happens. That is the whole method: build, run, observe, fix. Prose can look correct and be wrong; a graph that runs tells you the truth.

Most chapters end the same way: a Gotcha that names the trap before you fall into it, and Bronze, Silver and often Gold challenges, with worked solutions in the companion repository. Nothing here was written from the documentation alone — the examples were run, on the versions the Colophon names, and several claims changed once they were.

  • Part I — Building Graphs. The core primitives, and a working document-answering bot with branching, loops, tools, persistence and human approval — with no language model in sight.
  • Part II — Empowering Graphs with LLMs. Structured output and its failure modes, tool-calling, typed state schemas, the Functional API, multi-agent supervisors, memory across turns, and streaming.
  • Part III — Graphs in Production. Error handling and retries, serving over HTTP, async at scale, observability, external tools over MCP, the internals of persistence, and a full RAG pipeline with evaluation.

The next book, Coding Agent in Small Pieces, takes one real agent apart and rebuilds it as a minimal runnable graph.

Zhao Han has been a professional programmer for more than twenty years, working on mobile apps, backend systems, security products, and developer tools. Most recently he built and evaluated AI agents for enterprise products.
ISBN

← Back to the cover