All concepts
LangGraph Workflow
Model an agent as a stateful graph of nodes and edges with memory and checkpoints.
Agentic AI · Advanced · ~8 min
In plain English
Draw the agent as an actual graph — nodes do work, edges decide where to go next — so the control flow is something you can see and test.
Why it's worth your time
It's the answer to 'my agent does something different every run': make the structure explicit instead of hoping the prompt holds.
If you remember three things
- Nodes are steps, edges are transitions, state is explicit
- Conditional edges give you branching you can reason about
- Checkpointing enables resume and human-in-the-loop pauses
Overview
LangGraph models agent workflows as directed graphs: nodes are steps (LLM calls, tools, routers), edges (including conditional ones) define control flow, and shared state threads through. Checkpointing enables persistence, human-in-the-loop pauses, and reliable retries.
How it works
- Enter the graph A run enters at START and hits the first node — an LLM call or a tool.
- Nodes read & write state Every node reads and updates one shared state object that threads through the whole graph.
- A conditional edge routes An edge inspects the state and decides which node runs next — this is the branching logic.
- Loop / reflect An edge can cycle back for retries or reflection — bounded by a max-iterations guard so it can't loop forever.
- Checkpoint the state After each node the state is checkpointed, so a run survives crashes and can resume exactly where it stopped.
- Human-in-the-loop For sensitive steps the graph pauses for human approval, then continues from the checkpoint.
- Reach END When the graph reaches END it returns the final answer — a controlled, observable, testable workflow.
In an interview
LangGraph represents an agent as a stateful graph — nodes do work (LLM calls, tools), edges route control (including conditional branches and cycles), and a shared state object flows through. Checkpointing persists state so you can pause for human approval, retry, and resume, making agent workflows more reliable than free-form loops.
Production defaults
- Model state explicitly
- a typed state object. Implicit state is where these systems go wrong
- Recursion limit
- set it. The framework default is a backstop, not a design
- Checkpoint
- so a run can pause for approval and resume without redoing the work
What breaks
- Graph loops until the recursion limit — A conditional edge that never routes to the end. Every cycle needs an exit condition you can state.
- State grows unboundedly — Nodes appending without pruning. Decide what each node may add and enforce it.