LangChain vs LangGraph
One framework chains steps forward. The other lets an agent loop, pause, and remember where it left off.
LangChain vs LangGraph is really a question about control flow, not brand loyalty.
LangChain gives you model wrappers, prompt templates, and 600-plus integrations you chain together in mostly one direction.
LangGraph gives you a state machine: a typed object that nodes read and write as the agent loops, retries, and waits on a human.
Most production teams end up using both - LangChain for the plumbing, LangGraph for the loop that decides what happens next.
LangChain vs. LangGraph: Side-by-Side
| Dimension | LangChain | LangGraph |
|---|---|---|
| Product type | Composition library (chains, prompts, integrations) | Stateful graph runtime built on top of LangChain |
| Execution model | Mostly linear - step A output feeds step B input | Cyclic graph - nodes can loop back, branch, or pause |
| State handling | Conversation-level memory (chat history helpers) | Typed state schema every node reads and writes |
| Checkpointing | None built in - you roll your own persistence | Built-in checkpointer resumes a run after a crash or restart |
| Human-in-the-loop | Manual - you write the pause/resume logic yourself | Native interrupt calls pause a run for approval, mid-graph |
| Best fit | RAG pipelines, prompt chains, single-pass tool calls | Multi-step agents, retries, long-running or human-gated workflows |
| License / cost | Open source (MIT), free to run yourself | Open source (MIT); LangGraph Platform/LangSmith add paid hosting and observability |
| Learning curve | Lower - closer to writing a function pipeline | Higher - requires thinking in nodes, edges, and state |
| Maintainer | LangChain | LangChain (same team, separate library) |
What Is LangChain?
LangChain is a Python and JavaScript library for wiring language models to data, tools, and prompts.
It ships model wrappers for OpenAI, Anthropic, and dozens of other providers, so you swap models without rewriting your app.
Its core unit is the chain: a sequence of steps like retrieve documents, format a prompt, call the model, parse the output.
LangChain also owns the integration layer - vector stores, document loaders, and output parsers that LangGraph reuses instead of rebuilding.
- 600+ provider and tool integrations out of the box
- LCEL (LangChain Expression Language) composes steps with a pipe syntax
- Best suited to retrieval pipelines and single-pass tool calls, not open-ended loops
Building an agent and unsure if you need a full stateful graph or a simple chain? We will scope it with you.
Book a ConsultationWhat Is LangGraph?
LangGraph is a low-level runtime for building agents that loop, branch, and remember state across steps.
Instead of a straight chain, you define a StateGraph: a set of nodes, the edges connecting them, and a typed state object every node can read and update.
Because the graph can cycle, an agent can retry a failed tool call, ask a follow-up question, or route to a different node based on what it just learned.
LangGraph is built on LangChain's model and tool abstractions, so it is not a replacement - it is the execution layer LangChain lacked.
- Built-in checkpointing resumes a run after a crash without losing state
- Native interrupt support pauses a run for human approval mid-graph
- Same team maintains both, so integrations carry over cleanly
The Core Difference: Chains vs Graphs
The core difference is that chains move forward and graphs can move backward.
A LangChain chain runs step 1, then step 2, then step 3, and stops. There is no built-in way for step 3 to send control back to step 1.
A LangGraph graph is a set of nodes with edges you define, including edges that loop back to an earlier node based on the current state.
That loop is what makes agentic behavior possible: an agent that checks its own output, decides it needs another tool call, and tries again without you writing a retry wrapper by hand.
State Handling: Memory Helpers vs a Typed Schema
LangChain tracks conversation history; LangGraph tracks the full state of the run.
LangChain's memory classes store what the user and model said, so the next prompt has context. That covers chatbots fine.
LangGraph requires you to define a state schema up front - a typed object with fields like messages, retry_count, or tool_results - and every node reads from and writes to it.
That distinction matters once an agent needs to remember something that is not a message, like how many times it has retried a failing API call or which branch of a decision tree it already tried.
- LangChain memory answers: what did we say to each other?
- LangGraph state answers: where are we in this multi-step task, and what have we tried?
Workflow: Checkpointing, Retries, and Human Approval
LangGraph checkpoints state after every node, so a crashed process can resume instead of restarting from scratch.
In plain LangChain, if your process dies mid-chain, that run is gone - you re-run it from the top and pay for every step again, including the model calls that already succeeded.
LangGraph's interrupt function pauses execution at a specific node and waits for a human to approve, edit, or reject the state before continuing.
That pattern is the difference between an agent that emails a customer without review and one that drafts the email, waits for a human click, then sends it.
Ecosystem: What You Reuse Between Them
LangGraph reuses LangChain's tools, model wrappers, and document loaders, so switching frameworks does not mean rewriting your integrations.
A retriever, prompt template, or output parser you built in LangChain drops into a LangGraph node with little change.
LangSmith, the paid observability layer, traces runs from both LangChain chains and LangGraph graphs in one dashboard.
Competing frameworks worth knowing here: CrewAI leans toward role-based multi-agent teams with less manual graph wiring, and AutoGen focuses on multi-agent conversation patterns. See AutoGen vs CrewAI and CrewAI vs LangGraph for how those stack up against a hand-built graph.
The Same Task, Written Both Ways
A simple retrieval-and-answer task shows the gap clearly: LangChain runs it once, LangGraph can retry it.
In LangChain, you retrieve documents, stuff them into a prompt, and call the model - three steps, one pass, done.
In LangGraph, the same three steps become nodes, but you add a fourth: a check-answer node that routes back to retrieve if the model says it does not have enough context.
That one extra edge - the loop back to retrieve - is the entire reason to reach for LangGraph instead of a chain.
- LangChain version: retrieve -> prompt -> generate -> return (linear, one attempt)
- LangGraph version: retrieve -> prompt -> generate -> check_answer -> (loop to retrieve OR return)
- The LangGraph version costs more tokens on average but fails less often on multi-hop questions
When To Choose Each
Choose LangChain when your task is a single pass: retrieve, summarize, classify, or answer, with no need to loop or pause.
Choose LangGraph when the agent needs to retry, branch on its own output, run for minutes or hours, or stop for a human to approve a step.
A support-ticket triage bot that reads a ticket and tags it fits LangChain - one pass, no retries needed.
A support agent that drafts a refund, checks it against a policy tool, and waits for a manager's approval before sending fits LangGraph - the approval step alone requires state and a pause.
- LangChain: RAG search, document Q&A, single-tool-call bots, prompt chains
- LangGraph: multi-step agents, anything with retries, anything with a human-approval gate, long-running background agents
Can You Use Both Together?
Yes - most teams shipping agents in production use LangChain for integrations and LangGraph for the control loop.
LangChain supplies the model wrapper, the retriever, and the output parser. LangGraph supplies the graph that decides when to call them and in what order.
You do not migrate away from LangChain to adopt LangGraph; you add a graph layer on top of the chains and tools you already built.
When we scoped routine automation work across the sites in our own portfolio, the pattern held there too - the reliable version of any multi-step agent was never a longer single chain, it was a short chain wrapped in a loop that could check its own work and retry.
The Verdict
LangChain and LangGraph are not really competitors - they are two layers of the same stack.
Pick LangChain alone for single-pass tasks: search, summarize, classify, answer, done.
Pick LangGraph when the task needs to loop, retry, remember state across steps, or pause for a human.
The LangChain vs LangGraph decision is less "which one" and more "how much control flow does this specific agent actually need".
Researched from primary vendor documentation and public regulator sources. Pricing and availability are accurate as of Aug 6, 2026 and can change — confirm current terms with each vendor before you buy.
Frequently Asked Questions
- No. LangGraph is built on top of LangChain and reuses its model wrappers, tools, and integrations. LangGraph adds the stateful, cyclic execution layer that LangChain does not have on its own.
- Usually not. A chatbot that answers one message at a time with conversation memory works fine in plain LangChain. LangGraph earns its complexity when the agent needs to retry steps, branch on its own output, or pause for human approval.
- Both libraries are open source and free under the MIT license. LangChain and LangGraph both offer paid add-ons - LangSmith for tracing and observability, and LangGraph Platform for managed hosting - but neither library itself charges to run. Verify current tiers on the vendor pricing pages.
- Yes, and you keep most of the code. Your retrievers, prompts, and model calls become nodes in a StateGraph. The main new work is defining the state schema and the edges, including any loop-back edges for retries.
- LangGraph checkpoints state after each node, so a crashed or restarted process can resume from the last completed step instead of starting over. Plain LangChain has no built-in equivalent - you would need to build your own persistence layer.
Not sure which framework fits your agent?
We build agent workflows for clients choosing between LangChain, LangGraph, and alternatives like CrewAI and AutoGen - and we have watched teams over-engineer a single-pass task into a graph it never needed. Book a free audit and we will map your actual workflow to the right level of control flow.
Book a Consultation