A chain runs steps in a fixed order. Real agent work needs branching, looping, pausing and resuming — and a chain gives you none of those without hand-rolled control flow.
Key points
- A graph makes control flow explicit and inspectable: nodes do work, edges decide what runs next.
- Because the structure is declared rather than buried in Python control flow, the runtime can checkpoint it, pause it, resume it and stream it.
- LangGraph v1 kept the core graph primitives — state, nodes, edges and the execution model — stable, so what you learn here transfers across versions.
- Reach for a graph when you need cycles, persistence across turns, human approval mid-run, or multiple agents. A single prompt-and-respond call does not need one.
Example
A research assistant must search, judge whether the results are sufficient, search again if not, then write. The “search again if not” edge is a cycle. In a chain you would write a while loop and lose the ability to pause, inspect or resume mid-loop. In a graph it is one conditional edge.
Try this
Install the package in a clean environment: pip install langgraph langchain. Confirm the version you have, since the API surface differs between major versions.