Same Job, Two Ways
Take the blog post job again: write it, review it, show it. Let us build it as a chain, and then as a graph.
In a chain
write, then review, then show. One pass. If the review fails, there is nowhere to go.
In a graph
write, then review. If the review fails, an arrow leads back to write. If it passes, we show the result.
Three Things a Chain Cannot Do
The chain works for a straight line. It fails the moment the job needs more.
| The job needs… | A chain | A graph |
|---|---|---|
| Another try after a mistake | cannot go back | an edge can lead back to an earlier step |
| Shared notes between steps | each step only gets the output of the one before | one shared state that every step reads and writes |
| Waiting for a human | cannot stop in the middle | the graph can pause, and continue later with the saved state |
Head to Head
The same comparison, one row at a time.
| LangChain chain | LangGraph graph | |
|---|---|---|
| Shape | a line that moves forward | any shape, with loops allowed |
| Next step | fixed by the pipe | | chosen by edges, including conditions |
| Data between steps | the output of the last step | one shared state |
| Memory across messages | you add it by hand | built in: the graph saves its state (a checkpointer) |
| Human approval | hard to add | built in: interrupt() pauses the graph |
Which One Should I Use?
A graph is not always better. It is more work, so use it only when you need it.
Use a chain when
The steps are always in the same order.It is a single question and a single answer, like simple RAG or a summary.Nobody needs to approve anything in the middle.It finishes in one pass.Use LangGraph when
The work must be checked and repeated.The model must keep choosing tools until it is done.A person must approve a risky step.Several specialised steps work as a team.Quick Revision
The whole lesson on one page.
Chain
A line
Prompt, model, parser. It only moves forward.
Graph
Steps and arrows
Nodes do the work, edges join them, and the state is shared. It can loop and pause.
Choosing
Start simple
Use a chain for a straight line. Use LangGraph when the job needs loops, memory or approval.