Blank white background with no objects or features visible.

Hello, EMEA! TrueFoundry is growing our footprint across Europe, the Middle East, and Africa. Read more. →

LangChain vs LangGraph: Which Should You Use in 2026?

By TrueFoundry

Updated: November 17, 2026

Published: August 20, 2025

Guide to Langgraph vs Langchain

‍

⚡ TL;DR
  • LangChain and LangGraph are no longer rivals. Since the 1.0 releases in October 2025, LangChain agents run on the LangGraph runtime, so the real question is which layer you want to work at.
  • Use LangChain's create_agent for standard tool-calling agents that you want to ship quickly. Add middleware for approvals, summarization and PII redaction.
  • Use LangGraph directly when you need explicit control: custom branching and loops, mixed deterministic and agentic steps, durable state, and human review that can pause for days.
  • You can start with LangChain and drop down to LangGraph later without a rewrite, because agents from create_agent can sit inside a LangGraph workflow.
  • Either way, production needs a model gateway for routing, budgets, guardrails and tracing.

For a while, LangChain versus LangGraph looked like a choice between two frameworks. It no longer is. In October 2025 both libraries reached version 1.0, and LangChain's agents were rebuilt on top of the LangGraph runtime. LangGraph is now the foundation, and LangChain is the faster, higher-level way to use it.

That changes the question from "which framework?" to "which layer do I want to work at?" This guide explains each, shows current code for both, and gives a simple way to decide.

LangChain vs LangGraph at a Glance

LangChain (1.x)LangGraph (1.x)
What it isHigher-level framework for building agents and LLM appsLower-level runtime and framework for stateful, long-running agents
Core building blockcreate_agent, tools, middlewareNodes, edges and a shared state object
Control flowThe standard model-tools loop, customized with middlewareWhatever graph you design: branches, loops, retries, parallel steps
State and persistenceInherited from LangGraph (checkpointing, streaming, time travel)Explicit state schema with checkpointers for durable execution
Human in the loopHumanInTheLoopMiddleware for tool-call approvalFirst-class interrupts that pause and resume a run
Learning curveGentle. A working agent in a few linesSteeper. You design the graph
Best forFast delivery of standard agents and RAG appsCustom workflows, multi-agent systems and long-running processes

What Is LangChain?

LangChain is an open-source framework for building applications on top of language models. It gives you a common interface for models, tools, messages and retrieval across providers, so you can switch between OpenAI, Anthropic, Google and others without rewriting your app.

The 1.0 release narrowed its focus to agents. The main entry point is create_agent, which runs the standard loop: call the model, let it choose tools, run them, and stop when it has an answer. Its defining feature is middleware, which hooks into the loop. Built-in middleware covers human approval of sensitive tool calls, summarizing long histories, and redacting personal data, and you can write your own. Messages also gained standard content blocks, so reasoning traces, citations and tool calls look the same across providers.

Older pieces such as LLMChain and ConversationChain moved to a separate langchain-classic package, so many tutorials written before 2025 no longer match current code. Here is a minimal agent with the current API:

from langchain.agents import create_agent

def get_order_status(order_id: str) -> str:
    """Look up the status of an order."""
    return "Shipped"

agent = create_agent(
    model="anthropic:claude-sonnet-5-5",
    tools=[get_order_status],
    system_prompt="You are a helpful support agent.",
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "Where is order 4821?"}]}
)

What Is LangGraph?

LangGraph is a lower-level framework and runtime for agents that need to run reliably over time. You describe a workflow as a graph. Nodes are steps, edges decide what runs next, and a shared state object carries data between them. Because you define the edges, you can loop until a condition is met, branch on a result, run steps in parallel, or mix fixed code with model-driven decisions.

The runtime adds the features production agents need. Checkpointers save state after each step, so a run can survive a restart, pause for human review for as long as it takes, and resume exactly where it stopped. This example loops until three revisions are done and saves state under a thread ID:

from typing import TypedDict
from langgraph.graph import StateGraph, START, END
from langgraph.checkpoint.memory import InMemorySaver

class State(TypedDict):
    draft: str
    attempts: int

def improve(state: State):
    return {"draft": state["draft"] + " (revised)", "attempts": state["attempts"] + 1}

def route(state: State):
    return "improve" if state["attempts"] < 3 else END

builder = StateGraph(State)
builder.add_node("improve", improve)
builder.add_edge(START, "improve")
builder.add_conditional_edges("improve", route)

graph = builder.compile(checkpointer=InMemorySaver())
config = {"configurable": {"thread_id": "demo-1"}}
result = graph.invoke({"draft": "v1", "attempts": 0}, config)

LangGraph can be used on its own, and LangChain agents are built on it, so you can start high-level and move down without throwing work away. An agent from create_agent can also be dropped into a larger LangGraph workflow as one node.

Running LangChain or LangGraph in production?

Put an AI Gateway between your agents and your models for routing, fallbacks, budgets and tracing, deployed inside your own cloud.

Book a 30-min demo

When to Use LangChain

  • Your agent fits the standard loop. A model, some tools, and a final answer. Support bots, research assistants and RAG apps usually do.
  • You want speed. A working agent takes a few lines, and middleware covers common needs such as approvals and summarization.
  • You want to switch providers easily. The common model interface keeps vendor changes small.

When to Use LangGraph

  • You need a custom flow. Retries, loops, branches and parallel paths that the default loop does not express.
  • Steps are a mix of deterministic and agentic. You want code to decide some things and the model to decide others.
  • Runs are long or sensitive. Workflows that wait on a person for hours or days, or that need an audit trail of each step.
  • Multiple agents must coordinate. Separate roles passing work through shared state.
  • Latency and cost need tight control. You decide exactly when the model is called.

30-second check: LangChain or LangGraph?

Answer two questions about your project.

1. What shape is your workflow?

2. How much state must survive between steps?

Answer both questions to get a recommendation.

How to Decide

Start with LangChain's create_agent unless you already know you need custom control flow. It is the quickest way to something that works, and you lose nothing by starting there, since the same runtime is underneath. Move to LangGraph when you hit a wall: you need a flow the default loop can't express, state that has to survive long pauses, or tighter control over each step.

If you are moving old code, replace create_react_agent and legacy chains with create_agent, or keep legacy pieces working through langchain-classic while you migrate. Both libraries release often, so pin versions and read the changelog before upgrading.

Beyond the Framework: Running Agents in Production

Neither library decides which model a request goes to, how much a team may spend, what a guardrail should block, or how to trace a failure across ten steps and three providers. That is the job of a gateway layer.

TrueFoundry's AI Gateway sits between your agents and your models. Point your LangChain or LangGraph model calls at one OpenAI-compatible endpoint and you get routing and fallbacks across providers, per-team budgets and rate limits, guardrails, and request tracing, deployed inside your own cloud. It works the same whichever framework you pick, so changing frameworks later doesn't mean rebuilding your controls. If you'd like to see it with your own agents, book a demo.

For more on running agents safely at scale, see our guides to AI gateways and LLM cost optimization.

One gateway for every agent framework

Whether your agents are built with LangChain, LangGraph or something else, route every model call through a single governed endpoint.

Book a demo →Explore the AI Gateway

Final Thoughts

LangChain and LangGraph are two layers of one stack. Choose LangChain when you want to ship a standard agent quickly, and LangGraph when you need control over the flow and durable state. Because they share a runtime, the first choice is easy to revisit. What matters more in the long run is the production layer around them: routing, cost control, guardrails and tracing.

For platform and AI teams

Give every agent a production backbone

Model routing, cost controls, guardrails and end-to-end tracing across your LangChain and LangGraph workloads.

ile LangChain memory suits linear, simpler tasks.

Try now.

One gateway for all your models, MCP servers, and agents. No credit card needed.

Start free
Table of Contents

One Gateway for Every LLM, Agent and MCP Server

Book a 30-min with our AI expert

Book a Demo

The fastest way to build, govern and scale your AI

Book Demo
Summarize with
ChatGPT logo by OpenAI
Perplexity AI logo
Blurry red snowflake on white background, symmetrical frosty design with soft edges and abstract shape.

Discover More

No items found.
November 17, 2026
|
5 min read

Claude Code Limits Explained: Pro, Max and Ultra (Updated November 2026)

No items found.
Guide to Langgraph vs Langchain
November 17, 2026
|
5 min read

LangChain vs LangGraph: Which Should You Use in 2026?

comparison
A detailed guide on Claude Fable 5
November 17, 2026
|
5 min read

Claude Fable 5.2: API, Benchmarks, Pricing and How to Use It

Engineering and Product
openrouter vs litellm
November 17, 2026
|
5 min read

LiteLLM vs OpenRouter: Which Is Right for Your Team?

comparison
No items found.

Recent Blogs

Black left pointing arrow symbol on white background, directional indicator.
Black left pointing arrow symbol on white background, directional indicator.
Take a quick product tour
Start Product Tour
Product Tour