Pick the library that exposes the agent loop as an explicit graph
LangGraph models the agent loop as a typed StateGraph with nodes, edges, conditional edges, and shared state. Control flow that you can see in code, not hidden inside a while loop.
Picture four tools claiming to show you how a robot decides what to do next. One says 'trust me, it works' and hides the decision inside a black box. Another draws you a real map: here are the places the robot can go, here are the arrows between them, here is the rulebook it follows. The map-drawer is what we want. The other tools are useful for different jobs, one for piping water (composition), one for taking photos after the robot finishes (observability), but neither is the map.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
The four options in this MCQ sit at different layers of the LangChain ecosystem and the question is testing whether the candidate knows which one owns explicit graph-based control flow. The correct answer is LangGraph; the distractors each represent an adjacent concern (legacy orchestration, stateless composition, observability) that a candidate might confuse for control flow if they have not built recent agent code.
This section walks the four layers, explains why LangGraph is the right answer for 'explicit graph', and traces the historical arc that put LangGraph in the production default position in 2026.
What AgentExecutor actually does
AgentExecutor is the agent runtime that shipped with the original LangChain agents API. Under the hood it is a Python while-loop. The body of the loop: call the configured LLM with the current message history and the available tool definitions; if the LLM returns a tool call, run the tool and append the result to history; if the LLM returns a final answer or signals stop, exit and return. The whole orchestration runs inside one Python process's memory.
The user-facing API is intentionally hidden. You call agent_executor.invoke({'input': 'do something'}) and get back a result dict. There is no graph to inspect, no nodes to point at, no edges between steps. The loop is real and well-tested, but it is encapsulated. That encapsulation was the design. Early LangChain wanted 'one line to build an agent' as its pitch.
The cost of that encapsulation became apparent over 2023: agents were hard to debug because the loop was opaque, hard to extend because subclassing the executor was the only escape, hard to persist because there was no state primitive, hard to do human in the loop because the loop had no pause mechanism. The MCQ option 0 (AgentExecutor runs the loop visibly as a list of nodes and edges) inverts the actual design. It claims as a feature exactly what AgentExecutor was built to hide.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Tool | Layer | What it does | Use when |
|---|---|---|---|
| AgentExecutor | Legacy agent runtime | While loop dispatching LLM and tools | Maintaining old code; new code should not |
| LangGraph | Control flow | Explicit StateGraph with nodes, edges, state | Multi-step agents, HITL, durable workflows |
| LCEL | Composition | Stateless directed acyclic pipes via the pipe operator | Prompt to model to parser chains, transformations |
| LangSmith | Observability | Tracing, evaluation, prompt versioning | Debugging, testing, monitoring any of the above |
Real products, models, and research that use this idea.
- LangChain's official agent tutorials migrated from AgentExecutor to LangGraph in 2024
- Production teams deploying long-running research agents on Claude Opus 4.7 use LangGraph for the checkpointer
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does LangGraph supersede AgentExecutor instead of replacing LCEL?
LangGraph and AgentExecutor solve the same problem (agent loop orchestration) at different abstraction levels. Graph versus hidden loop. LangGraph and LCEL solve different problems. Control flow versus stateless composition. LangGraph nodes wrap LCEL Runnables; they are complementary, not competing.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Picking LCEL because it 'composes things'. LCEL builds directed acyclic pipes, not loops with shared state.
60 second bullets to scan on the way to the call.
The role of LangGraph as the explicit-graph control-flow library
Why AgentExecutor's loop is hidden rather than visible
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.