When should a team graduate from LangChain's AgentExecutor to a LangGraph StateGraph?
Your team is running an agent in production on `AgentExecutor`. At what point should you graduate to a `LangGraph StateGraph`, and what specifically does the StateGraph give you that the executor cannot?
Graduate when you need debuggability, durable state, or human in the loop approval, StateGraph makes the hidden AgentExecutor while-loop into an inspectable, checkpointable, interruptible graph.
Imagine driving with a closed-eyes navigation app vs an open map. AgentExecutor is the closed app, it gets you there, but if it takes a weird detour you cannot see which turn it picked or why, and if your phone dies mid-route you start over. StateGraph is the open map: every turn is a visible step, you can pause the trip, hand the wheel to a passenger for one decision, and even rewind to a previous junction and try a different road. For a quick errand the closed app is fine. For a complex delivery route with handoffs and recovery requirements, you want the map.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
State the trigger framework (crash recovery, HITL, debuggable replay), explain what each maps to in StateGraph (checkpointer, interrupt_before, state history), call out the verbosity tradeoff, name when the executor is still right, and close with the concrete migration-decision heuristic.
Real products, models, and research that use this idea.
- Replit's Agent migrated from a custom executor to LangGraph because IDE-disconnect and reconnect required durable session state across restarts.
- Norway's tax authority pilot used LangGraph `interrupt_before` to gate citizen-facing actions on a human caseworker's approval.
- LangChain's own production guidance explicitly recommends LangGraph as the migration target for `AgentExecutor`-based agents going to production.
- Anthropic's Claude Code uses graph-based agent orchestration to gate file-write and shell-execution actions on user approval, the same pattern LangGraph supports natively.
What an interviewer would ask next. Try answering before peeking at the approach.
QWalk through how a `PostgresSaver` checkpointer enables crash recovery in a real deployment.
QWhat's the practical difference between `interrupt_before` and `interrupt_after`, and when do you reach for each?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Graduating to LangGraph for a 50-line agent that calls one tool. The verbosity is overhead unless you have a concrete trigger like crash recovery or HITL.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.