Notes

LangGraph

An agent loop written as a while-statement is easy to start and hard to live with: you cannot pause it, you cannot see why it took the branch it took, and a crash loses the run. LangGraph takes the loop out of the code and makes it a graph the runtime can inspect, interrupt and resume.

The model

  • Nodes are functions — a model call, a tool execution, a validation step — each receiving the current state and returning an update to it.
  • Edges connect them, and conditional edges route on the state, so cycles, branching and retries are expressed rather than buried in a loop body.
  • State is one typed object with explicit rules for how each update merges in — the agent's memory for the run, not a growing prompt string.
  • Checkpointers persist that state after every step, so a run survives a restart and can be rewound to an earlier step and replayed.

What persistence unlocks
Durable state makes the hard features ordinary. An interrupt suspends the graph before a sensitive tool call and waits hours for a human verdict, because nothing is held in memory. A failed run resumes from the last good step instead of starting over. Multi-agent setups become subgraphs under a supervisor node. And because every step is a recorded transition, a trace in LangSmith shows precisely where a run went wrong. The cost is explicitness: you draw the control flow up front, which is more work than a while-loop and the reason the graph earns its keep past a prototype.

LangGraph is a framework for building agents as explicit graphs: nodes are steps, conditional edges express branching and cycles, and a typed state object carries data between them. A checkpointer persists that state after every step, which makes runs resumable after failure, pausable for human approval, and replayable for debugging. It is the control-flow layer beneath LangChain's components, aimed at loops that must survive production rather than demos.

Think of a flowchart on a wall: boxes for each step, arrows for what happens next, including arrows that loop back. LangGraph lets developers build an AI assistant as exactly that kind of flowchart.

The point is that the program always knows where it is. It can stop halfway and wait a day for someone's approval. It can pick up after a crash instead of starting the whole job again. And when it does something strange, you can follow the arrows and find the moment it went wrong.

Written as ordinary code, a loop like that is a black box. Drawn as a flowchart, it is something you can watch.