LangChain vs. LangGraph: Differences and When to Use Each
AICompare LangChain vs. LangGraph on architecture, use cases, and trade-offs. Find out which to pick when building agents, when to use both, and how to migrate.

Marijus Narbutas
Key Takeaways
-
LangChain is the agent framework, with the components and integrations for linear pipelines and simple agents.
-
LangGraph orchestrates stateful, dynamic workflows that require checkpointing.
-
Production applications typically combine both tools to scale reliably.
Developers in the agentic AI space often view these open-source frameworks as alternatives, but in reality they’re complementary layers, and LangChain’s agents run on LangGraph.
LangChain is the agent framework that offers wrappers, tools, and integrations for straightforward agents and pipelines. LangGraph, on the other hand, is the dedicated orchestration framework for AI agents that manages the runtime, holds state, handles iterative loops, pauses for human input, and recovers from system failures.
We’ll explore which tool is better for your AI workflow, when to use both at the same time, and how to transition your codebase smoothly as your application complexity scales.
What Is LangChain?
LangChain provides composable components for applications powered by large language models. It unites AI models, retrievers , and prompt templates into a single interface, and its create_agent function adds a prebuilt agent loop on top.
It’s great for linear pipelines, retrieval-augmented generation, and document analysis, as long as you’re not trying to build complex workflows. LangChain offers the shortest path to building agents and functional data chains.
Developers use the LangChain Expression Language for quick prototyping because it links these components with minimal boilerplate. In LangChain 1.0, agents are built with create_agent, while the expression language still suits data pipelines and predictable sequences.
What Is LangGraph?
LangGraph is an orchestration runtime that models AI workflows using a graph structure. It natively supports cycles, conditional routing, and persistent state management across steps.
Developers use LangGraph for these core production capabilities:
- Durable execution with checkpointing, so runs resume after a crash
- Human-in-the-loop interrupts
- State and token streaming
- Time travel for modifying and replaying past actions
Since LangGraph nodes are standard Python functions, you can orchestrate complex workflows through this runtime without ever importing LangChain components.
LangChain vs. LangGraph: Key Differences
| Feature | LangChain | LangGraph |
|---|---|---|
| Workflow shape | Linear chains and a prebuilt agent loop | Cycles, loops, and branching paths |
| State handling | Implicit state passed between immediate steps | Explicit state object preserved across the entire run |
| Control flow | Fixed sequences or a model-led tool loop | Conditional edges routed by state changes |
| Error recovery | Component-level retry logic | Durable checkpointing to resume from exact failure points |
| Multi-agent support | Subagent and router patterns for multi-agent systems | First-class routing and multi-agent collaboration across boundaries |
| Learning curve | Gentle introduction to components and prompt engineering | Steeper concepts involving schemas and reducers |
| Best fit | Prototypes, basic RAG, and linear processing | Long-running state machines and autonomous agents |
Is LangGraph Built on LangChain, or the Other Way Round?
It’s the other way round: LangChain 1.0 is built on top of LangGraph. The langchain package lists langgraph as a dependency, and its agent abstractions run on the LangGraph runtime.
LangGraph does depend on langchain-core, the shared package for primitives like Runnables, Tools, and Messages, but not on the langchain package itself, so you can use it without the framework layer.
In October 2025, LangChain renamed LangGraph Platform, which launched as LangGraph Cloud, to LangSmith Deployment. LangGraph Studio became LangSmith Studio at the same time.
When to Use LangChain vs. LangGraph
Use LangChain for retrieval-augmented generation pipelines, virtual assistant interfaces, text summarization, and early prototypes. Its document loaders can also load web pages, so it can sit at the end of an AI scraping pipeline and pass what your AI web scraping tools collect to a model.
Use LangGraph for multi-agent systems, handoffs between multiple agents, long-running sessions, human approval gates, and stateful and auditable workflows.
Production applications, however, usually run both tools together. Developers place LangChain components inside LangGraph nodes so they can use the LangChain ecosystem for individual steps, while the LangGraph runtime orchestrates the overall state and routing logic.
Is LangGraph Overkill? Disadvantages to Know About
Using LangGraph for a linear pipeline introduces unnecessary boilerplate. If your application is processing user input and returning a direct response, a standard LangChain sequence is more than enough.
Adopting the graph runtime comes with several engineering trade-offs, such as a steeper learning curve, significantly more code for basic workflows, and additional infrastructure overhead.
How to Migrate From LangChain to LangGraph
To migrate, wrap only the parts of your pipeline that need branching or looping:
- Wrap existing chains as discrete nodes within the graph.
- Move routing logic and retries into conditional edges that handle failure states.
- Add a checkpointer to preserve the state object across execution steps.
- Keep your component-level work and external tools exactly where they currently run.
Upgrading to LangChain 1.0 brings breaking changes: it requires Python 3.10+, replaces create_react_agent from langgraph.prebuilt with create_agent, and moves legacy chains, retrievers, and the hub out of the main package. To keep that code running, the maintainers provide a legacy compatibility package called langchain-classic.
Where Deep Agents Fits
The ecosystem operates on a three-layer execution stack.
At the top of the agentic AI stack, Deep Agents is an agent harness built on LangGraph that provides opinionated defaults for subagent delegation, filesystem access, and context management, with task planning as an opt-in.
LangChain supplies the building blocks, middleware hooks, and API integrations. LangGraph manages orchestration, graph execution, and state persistence.
These layers work together to execute application logic, while LangSmith operates outside this stack to provide observability, evaluation, and deployment support.
Pinning Versions and Known Vulnerabilities
Self-hosting the checkpointer makes the orchestration layer part of your attack surface. These published advisories affect checkpoint storage and serialization in both libraries:
- LangGraph checkpointers: Unsafe msgpack deserialization when loading checkpoints, tracked as CVE-2026-28277, affects langgraph 1.0.9 and earlier and is fixed in 1.0.10. A SQL injection via metadata filter keys in the SQLite checkpointer, tracked as CVE-2025-67644, is fixed in langgraph-checkpoint-sqlite 3.0.1.
- langchain-core: A serialization injection flaw in dumps() and dumpd(), tracked as CVE-2025-68664, let crafted data load as LangChain objects and could expose secrets from environment variables. It’s fixed in 0.3.81 and 1.2.5.
Pin exact package versions and watch the GitHub security advisories for both langgraph and langchain-core. Always treat data deserialized from a stored checkpoint as untrusted input.
Final Thoughts
The LangChain vs. LangGraph choice isn’t either-or, since the two are layers of one stack. Start with LangChain for RAG, chat, and prototypes, and add LangGraph when a workflow has to branch, loop, pause for approval, or recover from a crash. Whichever you use, pin exact versions and watch the security advisories for both packages.
FAQ
Is LangGraph owned by LangChain?
Yes. LangGraph is built by LangChain Inc., the company behind LangChain, and both are open source under the MIT license. LangGraph is a separate package, though, so you can use it without LangChain. The company’s commercial platform, LangSmith, now also includes the former LangGraph Platform and LangGraph Studio.
Should I learn LangChain or LangGraph first?
Learn LangChain first. LangGraph’s docs recommend getting familiar with models and tools, and starting with LangChain’s prebuilt agents if you’re new to agents. Once those basics make sense, try LangGraph to orchestrate loops, multi-agent workflows, and interactions between multiple AI agents.
Can you use LangChain and LangGraph together?
Yes, LangChain components are often deployed inside LangGraph nodes. LangChain handles the interactions with language models and external APIs, whereas LangGraph manages state transitions and coordinates the overall workflow.
Is LangChain obsolete?
No. While its legacy agent abstractions are deprecated, the framework itself now centers on create_agent and still suits linear pipelines, RAG applications, and basic data extraction. Its 1,000+ integrations across models, tools, document loaders, and vector stores keep the LangChain ecosystem relevant.
Is LangGraph still relevant?
Yes. LangGraph is the runtime under LangChain’s agents and the Deep Agents SDK, so its durable execution, streaming, and human-in-the-loop features power both. Developers also use it directly when they need durable checkpointing, human approval gates, and multi-agent collaboration in their own graphs.
What are the alternatives to LangChain and LangGraph?
Some alternatives to LangChain and LangGraph include CrewAI, Pydantic AI, LlamaIndex, and OpenAI Agents SDK. They do serve different purposes, so you’ll need to choose one that suits your needs.