DEVELOPMENT TECHNOLOGIES

LangChain and LangGraph: Architecture, Use Cases, and LangChain vs LangGraph

How LangChain’s agent harness and LangGraph’s stateful runtime fit together, what teams build with them, and how they compare with LlamaIndex and Pydantic AI.
LangChain logo

What Is LangChain and LangGraph?

When comparing LangChain vs LangGraph, it helps to know that the two open-source libraries are complementary layers, not competitors. LangChain provides the high-level agent harness (create_agent), standard model interfaces, and more than 1,000 integrations. LangGraph provides the low-level stateful runtime (StateGraph) for cyclical, durable workflows. Teams use LangChain for fast setup and LangGraph for explicit control over state, routing, and human approvals.

LangChain was first released by Harrison Chase in October 2022 and gives Python and TypeScript developers a unified model interface, composable building blocks, and middleware. Version 1.0, released in October 2025, replaced the legacy AgentExecutor with create_agent, which runs on the LangGraph runtime, so simple agents inherit durable execution, persistence, and human-in-the-loop support. For background, see our article on what agentic AI is.

LangGraph models workflows as explicit graphs of shared state, nodes, and edges, mixing deterministic code with LLM-driven steps. It can be installed and used without any LangChain packages.

Both libraries are MIT-licensed and follow semantic versioning since 1.0, with no breaking API changes planned before 2.0. Current releases are listed in the official LangChain and LangGraph documentation.

How LangChain and LangGraph Work

LangChain standardizes how applications call models and tools, while LangGraph executes those steps in a message-passing state machine backed by persistent checkpointers and cross-thread stores. The commercial LangSmith platform adds tracing, evaluation, and hosting on top. The layers are summarized in the table below.

LangGraph’s execution model is inspired by Google’s Pregel. Execution runs in discrete super-steps: active nodes read the shared state, run code or LLM calls, and return updates that are merged before the next step. This explicit structure is what makes reliable agentic reasoning and planning loops possible without losing intermediate data.

Memory is split in two. Checkpointers such as PostgresSaver save a thread’s state at every super-step, enabling human approval pauses and time-travel replay. Stores keep long-term data that persists across separate user sessions. Subgraphs keep their own checkpoint namespace, so passing state back to a parent graph has to be configured explicitly.

Framework overhead is small compared with model latency. In a 2026 AIMultiple RAG benchmark, LangChain added about 10 ms per request and LangGraph about 14 ms.

LayerPackageRole
Model interface and agent harnesslangchain, langchain-coreUnified provider bindings, middleware, and create_agent, compiled onto the LangGraph runtime.
Graph orchestration runtimelanggraphState schemas, nodes, and fixed or conditional edges; usable standalone.
PersistenceCheckpointers and StoresThread-level state snapshots for interrupts and replay, plus cross-thread long-term memory.
Observability and hostingLangSmith (commercial)Tracing, evaluation, and managed deployment of agents.
Engineer's Take

We start with LangChain’s create_agent when a workflow is a single loop of tool calls and model responses, and drop down to a LangGraph StateGraph as soon as we need conditional branching, custom retries, or human approval gates; tools and model bindings carry over. The common production problems involve state: leaving InMemorySaver in place and losing every thread on the first restart, or putting large files into graph state, which is snapshotted at every step. We keep state lean with references to object storage, prune checkpoint tables, summarize long conversations, and upgrade each sub-package independently.

Diatom Enterprises favicon
Diatom engineering team
LangChain and LangGraph at a Glance
Type

Open-source LLM application and agent frameworks

Languages

Python and JavaScript/TypeScript

License

MIT; LangSmith is commercial

Strengths

1,000+ integrations, durable state, human-in-the-loop

Compared with
Need a reliable tech partner?
20+

Years in business

80+

Senior engineers

200+

Projects delivered

What LangChain and LangGraph Are Used For

Engineering teams use LangChain and LangGraph for tool-calling agents, stateful support workflows, human-reviewed financial processes, and retrieval pipelines. Klarna, Uber, J.P. Morgan, Replit, and AppFolio run LangGraph in production.

Customer Support Automation

Stateful support agents route inquiries through deterministic policy checks and LLM generation nodes. Klarna’s assistant, built on LangGraph, has handled 2.5 million conversations, and LangChain’s case study reports an 80% cut in resolution time.

Domain-Specific Copilots

SaaS platforms move linear prompt chains into graphs so the agent can validate tool outputs before answering. AppFolio’s Realm-X copilot runs on LangGraph and roughly doubled response accuracy with dynamic few-shot prompting.

Human-in-the-Loop Financial Workflows

With Postgres-backed checkpointers, a graph pauses before a high-risk API call, stores the exact state, and waits hours or days for a supervisor to approve or edit it before resuming, a pattern common in payments and fraud prevention.

RAG Pipelines and Coding Agents

LangChain integrations with vector databases and search APIs make hybrid retrieval pipelines quick to build, while platforms such as Replit use stateful graphs to loop through code generation, compilation, and test runs.

LangChain and LangGraph vs LlamaIndex and Pydantic AI

Among the main LangChain alternatives, teams weigh LangChain and LangGraph’s integrations and checkpointing against LlamaIndex’s document-centric pipelines and Pydantic AI’s strict type safety. Microsoft Agent Framework and CrewAI are other common options. All are MIT-licensed, so the decision rests on language, state model, and ergonomics.

Criteriontech logo langchainLangChain & LangGraphtech logoLlamaIndextech logo pydanticPydantic AI
Orchestration modelAgent harness on top of a Pregel-style graph state machine.Event-driven Workflows for document-centric, data-heavy pipelines.Type-safe agents with dependency injection and validated outputs.
LanguagesPython and JavaScript/TypeScript.Python first; the TypeScript workflows package is deprecated.Python only.
State & human-in-the-loopCheckpointers, cross-thread Stores, interrupts, and time-travel replay.Step state within data and document pipelines.Step checkpointing and durable execution through engines such as Temporal and DBOS; typed graphs with pydantic-graph.
Ecosystem1,000+ integrations across models, vector stores, and tools.Deep document ingestion with LlamaParse.Small, focused ecosystem.
Framework overheadAbout 10 ms (LangChain) and 14 ms (LangGraph) per request in a 2026 RAG benchmark.About 6 ms per request in the same benchmark.Minimal wrapper overhead.
Commercial platformLangSmith for observability and deployment.LlamaParse and LlamaCloud.Pydantic Logfire for observability.
Swipe the table to compare →

When to Choose LangChain and LangGraph

Choose LangChain and LangGraph when you need provider-agnostic integrations, parity between Python and TypeScript, and deterministic control over complex state. Compared with CrewAI’s role-based crews, LangGraph takes more upfront code but gives deterministic branching, per-node checkpointing, and replay without the token overhead of conversational state passing.

When LangChain and LangGraph Are Not the Right Fit

If your team writes C# and deploys only on Azure, Microsoft Agent Framework fits the Microsoft stack more naturally. For pure document ingestion and OCR pipelines, LlamaIndex with LlamaParse is purpose-built. For single-agent Python services where strict type safety and quick onboarding matter more than graph interrupts and integrations, Pydantic AI is the cleaner choice.

How We Approach LangChain and LangGraph Projects

We design LangChain and LangGraph systems with explicit state schemas, Postgres-backed persistence, strict dependency management, and trace-based evaluation before adding complex multi-agent routing. This is the foundation of our AI agent development services.

Migration and Durable Persistence

We move legacy AgentExecutor code to create_agent or explicit graphs, replace in-memory savers with PostgresSaver, prune old checkpoints on a schedule, add summarization middleware for long threads, and keep large files out of graph state.

Sub-Package Security

langchain, langchain-core, langgraph, and the checkpoint packages are patched independently, and serious serialization and checkpoint vulnerabilities were disclosed in 2025 and 2026. We pin and scan every sub-package and restrict tool credentials with allowlists.

Tracing and Evaluation

Every agent run is traced, and evaluation suites run against real traces before prompts, models, or graph routing change. Where LangSmith is used, we configure data residency and retention to match compliance needs.

Sound like the right partner?

Tell us about your project. We'll get back to you within 1 business day.

Frequently Asked Questions

Direct answers to common architectural, licensing, and migration questions when evaluating LangChain and LangGraph.

Is LangGraph replacing LangChain?

No. They serve different layers and can be used together or separately. Since 1.0, LangChain’s create_agent runs on the LangGraph runtime, giving simple agents durable execution in a few lines of code. You can also use langgraph on its own when you want a custom StateGraph with your own nodes, edges, and routing.

Is AgentExecutor deprecated in LangChain 1.0?

Yes. The legacy Agent and AgentExecutor classes were deprecated with LangChain 1.0 in October 2025 and are in maintenance mode, with official guidance to migrate to create_agent by December 2026. Both libraries now follow semantic versioning with no breaking changes before 2.0.

Are LangChain and LangGraph free for commercial use?

Yes. The LangChain, LangGraph, and Deep Agents libraries are free for commercial use under the MIT License. You pay only if you use the commercial LangSmith platform for tracing, evaluation, or managed deployment, which has a free developer tier and paid team and enterprise plans.

How does LangGraph compare to CrewAI for multi-agent systems?

CrewAI organizes agents as role-based crews with personas and goals, which makes multi-agent prototypes fast. LangGraph models workflows as explicit state machines. It needs more upfront code for state schemas and routing, but avoids CrewAI’s token overhead from conversational state passing and gives deterministic branching, per-node checkpointing, and replay. See our guide to multi-agent frameworks.

How do we secure LangChain and LangGraph deployments?

Upgrade every sub-package independently, because upgrading langchain alone does not patch langchain-core or the checkpoint packages, which have had serious serialization, path traversal, and SQL injection fixes. Combine strict version pinning and dependency scanning with least-privilege tool credentials and explicit deserialization allowlists.

The People Behind

A team of skilled engineers, architects, and delivery managers, dedicated to making every engagement a success.

Let's discuss your project