29 November 2026 · 9 min read · Download as PDF
LangChain vs LangGraph: the same agent in both, a comparison table, and the edge cases
LangChain gives you create_agent, a ready-made loop; LangGraph is the runtime you draw graphs on. The two side by side in a table, one agent written at both layers, human approval in each, the edge cases that bite in production, and the versions on 28 Nov 2026.
Space Llama's two-and-a-half-minute video, LangChain vs LangGraph: which do you need?, explains why the two aren't rivals and gives four questions for choosing a layer. This article holds what a short video can't: the two side by side in a table, the same agent written at both layers, human approval in each, the edge cases that catch people out, the current versions, and every source.
TL;DR
- LangChain is the agent framework: one interface over many model providers and tools, plus
create_agent, a ready-made agent loop you shape with middleware. - LangGraph is the runtime underneath: you declare state, nodes and edges yourself, and it gives you checkpoints, interrupts for human approval, and streaming.
- Installing LangChain installs LangGraph.
langchain1.5.2 depends onlanggraph1.2.x. The reverse isn't true:langgraphdoesn't depend on thelangchainpackage, thoughlangchain-coreis among its dependencies. - Start with
create_agentwhen a model with some tools is enough. Write a LangGraph graph when you need to decide the steps, branch, loop on your own terms, or pause for a person in the middle of your own logic. - Versions on 28 Nov 2026:
langchain1.5.2 (18 Nov 2026) andlanggraph1.2.24 (20 Nov 2026) on PyPI, both MIT licensed. Both reached 1.0 on 17 Oct 2025.
LangChain vs LangGraph at a glance
LangChain | LangGraph | |
|---|---|---|
What it is | An agent framework: "a minimal, highly configurable agent harness" | "A low-level orchestration framework and runtime for long-running, stateful agents" |
You write | A model, tools, a system prompt and middleware | State, nodes (steps) and edges (which step can follow which) |
The loop | A set core loop (call the model, run the tools it picks, stop when it calls no more) that middleware can retry, limit, pause or stop | Whatever you draw: branches, loops, steps your code decides next to steps a model decides |
Main entry point |
|
|
Human approval |
|
|
Saving and resuming | Pass | Pass |
Subagents | Multi-agent subagents | Subgraphs |
Memory | Short-term and long-term memory, built on LangGraph's | Checkpointers (one thread) and stores (across threads) |
Streaming | Agent streaming | Tokens, state updates and other events |
Default step limit | 9,999 steps | 10,007 super-steps (since 1.1.4) |
Depends on |
|
|
Python | 3.11 or newer | 3.10 or newer |
Latest (28 Nov 2026) | 1.5.2 on PyPI; 1.6.8 on npm ( | 1.2.24 on PyPI; 1.7.5 on npm ( |
License | MIT | MIT |

Both layers run on the same LangGraph runtime. Open this diagram in archhy, free, to copy and change it.
The same agent loop, written at both layers
The quickest way to feel the difference is to read the same loop both ways. Both samples come from LangChain's own docs, so the tools differ (a weather tool in one, calculator tools in the other), but the loop is the same: model, tools, back to the model. Each docs page has tabs for other model providers; swap in yours.
LangChain: the ready-made loop
# pip install -qU langchain "langchain[openai]"from langchain.agents import create_agentdef get_weather(city: str) -> str: """Get weather for a given city.""" return f"It's always sunny in {city}!"agent = create_agent( model="openai:gpt-6.1-sol", tools=[get_weather], system_prompt="You are a helpful assistant",)result = agent.invoke( {"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]})print(result["messages"][-1].content_blocks)You never say what happens next. create_agent calls the model, runs whichever tool it picks, feeds the result back, and stops when the model calls no more tools. The docstring is how the model learns what the tool does.
LangGraph: the loop drawn by hand
Here is the core of LangGraph's own quickstart, a calculator agent. The state class MessagesState (the quickstart defines its own, with a message list and a count of model calls) and the two nodes, llm_call and tool_node, are plain Python defined earlier in that quickstart; what matters here is the wiring:
# pip install -U langgraph langchain langchain-anthropicfrom typing import Literalfrom langgraph.graph import StateGraph, START, ENDdef should_continue(state: MessagesState) -> Literal["tool_node", END]: """Decide if we should continue the loop or stop based upon whether the LLM made a tool call""" messages = state["messages"] last_message = messages[-1] # If the LLM makes a tool call, then perform an action if last_message.tool_calls: return "tool_node" # Otherwise, we stop (reply to the user) return ENDagent_builder = StateGraph(MessagesState)agent_builder.add_node("llm_call", llm_call)agent_builder.add_node("tool_node", tool_node)agent_builder.add_edge(START, "llm_call")agent_builder.add_conditional_edges( "llm_call", should_continue, ["tool_node", END])agent_builder.add_edge("tool_node", "llm_call")agent = agent_builder.compile()This graph does the same job as create_agent: model, tools, back to the model, stop. The difference is that the loop is now yours. You can add a check step between the tools and the model, send a low-confidence answer to a person, or put a step that never calls a model at all. The docs' quickstart installs langchain only for its model and tool helpers. LangGraph itself doesn't need it: a node can call any model client you like.
Human approval in each layer
Pausing for a person is where the two feel most different, and where most people first move down a layer.
In LangChain: middleware per tool
from langchain.agents import create_agentfrom langchain.agents.middleware import HumanInTheLoopMiddlewarefrom langgraph.checkpoint.memory import InMemorySaveragent = create_agent( model="gpt-6.1-sol", tools=[write_file, execute_sql, read_data], middleware=[ HumanInTheLoopMiddleware( interrupt_on={ "write_file": True, # All decisions (approve, edit, reject, respond) allowed "execute_sql": {"allowed_decisions": ["approve", "reject"]}, # No editing allowed "read_data": False, # Safe operation, no approval needed }, ), ], # Human-in-the-loop requires checkpointing to handle interrupts. checkpointer=InMemorySaver(),)The run stops before a listed tool runs. You show the pending call to a reviewer, then resume on the same thread:
from langgraph.types import Commandconfig = {"configurable": {"thread_id": "some_id"}}result = agent.invoke( {"messages": [{"role": "user", "content": "Delete old records from the database"}]}, config=config, version="v2",)print(result.interrupts) # the pending execute_sql callagent.invoke( Command(resume={"decisions": [{"type": "approve"}]}), # or "reject" config=config, # Same thread ID to resume the paused conversation version="v2",)Note the imports: the checkpointer and Command come from langgraph. That's the runtime underneath showing through.
In LangGraph: interrupt() anywhere
from langgraph.types import interrupt, Commanddef approval_node(state: State): # Pause and ask for approval approved = interrupt("Do you approve this action?") # When you resume, Command(resume=...) returns that value here return {"approved": approved}# Later, with a graph compiled with a checkpointer:config = {"configurable": {"thread_id": "thread-1"}}result = graph.invoke({"input": "data"}, config=config, version="v2")resumed = graph.invoke(Command(resume=True), config=config, version="v2")The payload you pass to interrupt() must be JSON-serializable, and the graph needs a checkpointer and a thread ID. The middleware gates tool calls. interrupt() can gate anything: a plan before it runs, a draft before it's sent, a branch your own code chose. If the approval belongs to a tool call, the middleware is less code. If it belongs to your own logic, draw it.

The four questions from the video, as a flowchart to keep. One refinement the flowchart has no room for: tool-call approvals and checkpointed resume also work inside create_agent, as shown above. You need your own graph when the pause or the recovery point belongs to your own logic. Open this diagram in archhy, free, to copy and change it.
Edge cases that catch people out
These come straight from LangChain's docs, and each one bites in production rather than in a demo.
- Code before an
interrupt()runs again. On resume, "the node restarts from the beginning of the node where theinterruptwas called", so anything before the call runs again. The docs' advice: make anything before the interrupt idempotent, put side effects (an email, a payment, a database write) after it, or in a node of their own, and re-read prices or stock after a long pause. Even then a node that fails after its side effect can run again on retry, so deduplicate writes in the system you call. - A new
thread_idis a new conversation. You must resume with the same thread ID. A new value "starts a brand-new thread with an empty state", so a lost ID looks like an agent that forgot everything. InMemorySaverforgets on restart. It keeps checkpoints in RAM. For anything that must survive a deploy or a crash, use a database-backed checkpointer such asPostgresSaver, orSqliteSaverfor local work. With Postgres, keep thread IDs under 255 characters, and prune old checkpoints, which pile up over long conversations.- Don't pass
Command(update=...)to start a new turn.Command(resume=...)is the onlyCommandmeant as input. AnyCommandinput resumes from the latest checkpoint, not fromSTART, "so a finished thread can look stuck". Start a new turn with a plain dict. - Static and conditional edges from one node don't mix. "For each node, use either static edges or dynamic routing ... not both. Mixing them can run both paths."
- The step limits are generous.
create_agentsets its recursion limit to 9,999 steps, and a LangGraph graph defaults to 10,007 super-steps (since 1.1.4), after which it raisesGraphRecursionError. They count graph steps, not model calls, and an agent stuck calling tools can loop for a long time before it hits them. For production, pass a lowerrecursion_limitas a top-level config key (not underconfigurable), or addModelCallLimitMiddleware. - "Reject", not "respond", to refuse a tool. In the human-in-the-loop middleware,
respondis for "ask the user" tools: its message is "treated as a successful tool result". Userejectto deny a side effect. - Batched or per-call approval. The middleware's default
interrupt_modeis"batched": one interrupt per model turn, answered with an ordered list. LangChain recommends"per_call"(langchain 1.4.6 or newer) for new agents and plans to make it the default in the next major release. - LangChain pins LangGraph.
langchain1.5.2 requireslanggraph1.2.12 or newer but below 1.3.0. If you use both, upgrade them together rather than bumping LangGraph alone. - "LangGraph doesn't need LangChain" means the
langchainpackage.pip install langgraphstill brings inlangchain-core, the shared base library for messages and model interfaces.
Migrating from older code
create_react_agentis deprecated. LangGraph's old prebuilt agent was replaced by LangChain'screate_agentin the 1.0 releases, which added middleware for retries, summarization, approvals and more.- Old chains and helpers moved to
langchain-classic. LangChain 1.0 slimmed thelangchainnamespace down to the building blocks for agents. If an older tutorial's import fails, it probably lives inlangchain-classicnow (1.1.0 on PyPI). - LangGraph 1.0 changed little. The LangGraph v1 release notes call it "a stability-focused release": state, nodes, edges and the execution model are unchanged.
FAQ
Is LangGraph replacing LangChain?
No. Both come from LangChain, the company, and since 1.0 LangChain's agents run on LangGraph. The LangChain overview puts it plainly: use create_agent for "a highly customizable harness", and LangGraph "for advanced needs combining deterministic and agentic workflows".
Do I need to learn LangGraph to use LangChain?
No. LangChain's docs say "you don't need to know LangGraph to use LangChain." You'll meet a few LangGraph names anyway (checkpointers, Command, thread_id) as soon as you add memory or approvals. A checkpointer is short-term memory for one thread, the conversation so far; for memory across threads, such as a user's preferences, LangGraph has a separate store.
Can I use LangGraph with the OpenAI or Anthropic SDK directly?
Yes. A node is a plain function, so it can call any client. LangGraph's own examples often use LangChain's model wrappers for convenience, but that's a choice, not a requirement.
Can I mix the two in one app?
Yes, and it's common. An agent from create_agent is a LangGraph graph under the hood, so you can run it inside a larger graph of your own, next to steps your code decides.
Is there a JavaScript or TypeScript version?
Yes, both have one: langchain (1.6.8) and @langchain/langgraph (1.7.5) on npm, with their own docs.
What about Deep Agents and LangSmith?
Deep Agents is a ready-made harness on top of LangGraph (planning, subagents, file tools, context management) for long, open-ended tasks. LangSmith is the hosted platform for tracing, evaluating and deploying agents built with any of these, or with other frameworks.
Do I need either one?
Not always. If the steps are fixed in advance, plain code is easier to read and debug. Lesson 5, Do you need a framework at all?, makes that case.
Keep going
- Watch it: LangChain vs LangGraph: which do you need?, the video this article goes with.
- Each one on its own: What is LangChain? and What is LangGraph?
- The comparison people often mean instead: CrewAI vs AutoGen.