If you're building AI agents, you'll run into both LangChain and LangGraph within your first few projects. These two frameworks come from the same team at LangChain and show up in the same tutorials, but they do very different things. Picking the wrong one for your use case can mean rewriting a lot of code later.
This guide walks through what each framework does, how they differ in practice, and how to deploy both on Vercel.
Copy link to headingWhat is LangChain?
LangChain is an open-source framework that provides a standard interface for models, embeddings, vector stores, and other components used in LLM-powered applications. The name comes from the idea of chaining steps together, where you take a prompt, pass it to a model, parse the output, and feed it forward. LangChain gives you a unified API to compose those steps without locking into a single provider.
The framework has evolved since its 2022 launch, expanding into LangChain Expression Language (LCEL) and the Runnable abstraction, which lets teams compose pipelines using a declarative pipe syntax like prompt | llm | StrOutputParser().
The v1.0 release introduced create_agent as its primary agent primitive, along with a middleware system for customizing the agent loop. A team building a customer support chatbot, for example, can use LangChain to wire together a retriever, a prompt template, and an LLM in a single chain that handles the full question-to-answer flow.
Copy link to headingWhat is LangGraph?
LangGraph is an orchestration framework for building and deploying long-running stateful agents. The name reflects the core idea. Instead of a linear chain of steps, LangGraph models workflows as a graph with branches, loops, and decision points that can send execution down different paths depending on what the agent learns along the way. That graph is built on three primitives:
State: The current execution snapshot, representing everything the workflow knows at a given point in the run.
Nodes: Functions that receive state, do work, and return an updated version of that state.
Edges: Functions that determine which node runs next based on the current state.
The framework is intentionally low-level and built for looping workflows that evolve state over time. A coding assistant that writes code, runs tests, reads the errors, and then rewrites the code illustrates this well, because the workflow needs to loop back and retry until the tests pass.
LangGraph can run standalone, though LangChain components like retrievers and model integrations are often used within LangGraph nodes. The framework reached General Availability at v1.0, and its TypeScript implementation @langchain/langgraph follows the same graph-oriented model.
Copy link to headingKey differences between LangChain and LangGraph
LangChain handles component composition and LangGraph handles workflow orchestration. The differences below show how that boundary plays out in practice.
Copy link to headingArchitecture
LangChain's LCEL works best for forward-moving pipeline composition, while LangGraph models workflows as cyclic state graphs that support repeated decisions and state updates.
For example, consider a document summarization tool. With LangChain, the document goes in, the summary comes out, and the chain is done. With LangGraph, the agent could generate a summary, evaluate its quality, and loop back to revise it until it meets a threshold.
Copy link to headingState management
LangChain is stateless by default between invocations, so each call starts fresh. LangGraph takes the opposite approach, with teams defining a typed state schema upfront using TypedDict or Pydantic models that persist and evolve throughout the workflow.
This is important for multi-turn conversations. A LangChain-based chatbot needs external storage to remember what the user said three messages ago. A LangGraph agent can persist that context in graph state when configured with a checkpointer and invoked with a consistent thread_id.
Copy link to headingWorkflow complexity and decision routing
For linear, predictable workflows, LCEL's pipe syntax keeps things concise. If the path from input to output is fixed, one chain definition can cover the entire pipeline with minimal code.
LangGraph treats conditional edges as first-class primitives. A content moderation agent, for example, needs to handle flagged content differently from clean content. In LangGraph, that branching logic is part of the graph definition, while in LangChain you'd build the routing yourself outside the chain.
Copy link to headingMulti-agent support
For combinations of deterministic and agentic workflows, even LangChain's official documentation points to LangGraph. The multi-agent model treats each agent as a node with its own prompt, LLM, tools, and state schema.
Consider a research workflow. One agent searches the web, another evaluates source credibility, and a third synthesizes the findings. Each agent focuses on its specialty, and the graph manages the handoffs between them.
Copy link to headingHuman-in-the-loop capabilities
LangChain implements human-in-the-loop through a middleware layer, which covers basic approval flows.
LangGraph's interrupt() primitive can be called at any point inside a node, saving the full graph state via checkpointing and waiting for human input before resuming through Command(resume=...). For a financial transaction agent that needs manager approval before executing trades, the workflow pauses, the manager reviews it hours later, and the agent picks up exactly where it left off.
Copy link to headingScalability and performance
LangChain scales horizontally and fits naturally into serverless architectures because each invocation is independent. LangGraph can also run on serverless infrastructure, but teams need to plan for checkpoint storage alongside compute.
LangGraph also provides retry policies, node-level caching, and time-travel debugging. If an agent fails on step 47 of a 50-step workflow, teams can replay from any checkpoint rather than starting over.
Copy link to headingLearning curve
Getting started with LangChain is faster because create_agent and LCEL's pipe syntax keep the initial setup quick. As workflow complexity grows, though, most developers move toward LangGraph's more explicit orchestration model.
LangGraph requires understanding graph theory, state machines, and reducer functions upfront. For simpler use cases, starting with LangChain and migrating later is a perfectly valid path. Both frameworks also work well with Vercel's AI SDK, so the deployment side of the learning curve stays the same regardless of which one you pick.
Copy link to headingLangChain vs. LangGraph use cases
The right framework depends on your workflow shape. LangChain covers straightforward pipelines: RAG chatbots, document processors, and quick prototypes. LangGraph takes over when your agents need to loop, coordinate with other agents, or pause for human review.
Copy link to headingWhen to use LangChain
LangChain fits when the workflow is linear: no loops, no need to persist state between requests.
RAG pipelines: A retrieve-prompt-generate flow where data moves in one direction without looping back.
Prompt templating: Reusable prompt structures that standardize how teams interact with different model providers.
Single-pass document processing: Extraction, summarization, or classification tasks that run once per input without looping.
Rapid prototyping: Getting a working demo in front of stakeholders quickly, where shipping fast is the priority.
Start with LangChain for linear workflows. Once the workflow needs to maintain state across steps, LangGraph handles that orchestration layer.
Copy link to headingWhen to use LangGraph
LangGraph is the right pick when your workflow needs to make decisions, loop, or survive interruptions:
Cyclic workflows: The agent needs to retry, reflect, or self-correct by looping back through earlier steps.
Multi-agent coordination: Multiple specialized agents need to hand off work and share state within a single workflow.
Human-in-the-loop approval: A human reviewer needs to approve, reject, or modify output mid-workflow before the agent continues.
Durable state persistence: The workflow must survive process restarts and resume from exactly where it left off across sessions.
Once any of those apply, orchestration becomes part of the application design, and LangGraph gives teams the primitives to model those variable paths explicitly.
Copy link to headingUsing LangChain and LangGraph together
Running the two together is common in production. LangChain components like retrievers, tools, and prompt templates operate inside LangGraph nodes, while LangGraph handles orchestration and state management.
A customer onboarding system is a good example. LangChain handles pulling user data and classifying the account type, while LangGraph decides which onboarding path to take and pauses for human review if the account is flagged. An AI writing assistant works similarly, with LangChain powering each generation step while LangGraph manages the write-review-revise loop.
Copy link to headingLangChain strengths and tradeoffs
LangChain's biggest advantage is prototyping speed.
Copy link to headingLangChain strengths
That speed comes from a few specific strengths:
Broad integrations: Support for model providers, vector stores, and tools gives teams a wide selection of interoperable components out of the box.
Concise composition: LCEL's pipe syntax and the
Runnableinterface keep pipeline definitions short and readable.LangGraph compatibility: Current releases align closely with LangGraph, so teams can start with LangChain and add graph-based orchestration later without rewriting components.
All of these still apply when you add LangGraph on top, since LangChain components run inside LangGraph nodes.
Copy link to headingLangChain tradeoffs
LangChain's linear model has limits that surface as projects grow:
No native state persistence: Maintaining context across invocations requires external solutions, which adds complexity for multi-turn workflows.
Limited branching: More involved routing logic often lives outside the chain, making it harder to reason about the full workflow in one place.
Structural ceiling: Cyclic or multi-agent workflows tend to outgrow the chain abstraction, pushing developers toward LangGraph.
In that situation, pairing LangChain with LangGraph adds the orchestration layer while keeping LangChain's components intact.
Copy link to headingLangGraph strengths and tradeoffs
LangGraph earns its complexity budget when workflows need fine-grained control over state and branching.
Copy link to headingLangGraph strengths
LangGraph provides control and transparency that LangChain's higher-level abstractions don't:
Full inspectability: All nodes and edges are plain Python functions, which makes execution behavior easy to trace and debug.
Native multi-agent support: Orchestrating multiple agents, human-in-the-loop workflows, and stateful execution is a first-class part of the graph model.
Time-travel debugging: Checkpoint replay lets teams step backward through a workflow's execution history to diagnose issues.
If you need visibility into what your agent is doing at each step, LangGraph gives you that by default.
Copy link to headingLangGraph tradeoffs
The graph-based model introduces complexity that not every project needs:
Steeper learning curve: Graph theory, state machines, and reducer functions are prerequisites before building your first agent.
More upfront design work: Defining state schemas, nodes, and edges requires more planning than wiring together a LangChain pipeline.
Overkill for linear workflows: Simpler pipelines that move in one direction don't benefit from graph-based orchestration.
If your workflows are cyclic or stateful, that upfront design work pays off quickly. Simpler pipelines are better served by LangChain alone.
Copy link to headingFrom agent logic to production on Vercel
Both frameworks integrate with Vercel's infrastructure through the AI SDK and its LangChain adapter.
Copy link to headingServerless agents with Vercel Functions
Vercel Functions support AI workloads with fluid compute, which handles multiple in-flight requests on a single function instance and reduces cold starts. Execution duration defaults to 300 seconds and goes up to 1800 seconds on Pro and Enterprise.
The @ai-sdk/langchain adapter, rewritten for AI SDK v6, connects LangGraph-style streaming workflows directly to the AI SDK's streaming interfaces.
Copy link to headingAgent UIs with v0 and the AI SDK
The AI SDK's useChat hook provides the client-side foundation for agent interfaces, handling message state, streaming responses, and tool approval flows. AI SDK 6 added LangGraph-specific adapters that connect graph-based workflows directly to these interfaces.
v0 generates production-ready Next.js code from natural language descriptions, making it a fast way to scaffold agent UIs. A community template for agent builders provides a visual workflow editor with text generation via AI Gateway and memory persistence.
Copy link to headingStart building with LangChain and LangGraph on Vercel
In practice, complex agent projects tend to use both frameworks, with LangChain handling the individual components and LangGraph managing the orchestration between them. On Vercel, both integrate with production services through AI Gateway, and Fluid compute handles AI workloads with minimal infrastructure overhead.
If you want to see both in action, the LangChain starter template is a good place to start, with a Next.js project that includes chat, agents, and retrieval use cases ready to deploy.
Copy link to headingFrequently asked questions about LangChain vs. LangGraph
Copy link to headingCan you use LangChain and LangGraph together?
Yes, and most teams building complex agents use both. LangChain components like retrievers and prompt templates operate inside LangGraph nodes, while LangGraph handles orchestration and state management.
Copy link to headingIs LangGraph production-ready?
Yes, LangGraph reached General Availability at v1.0, so it's built for production use. Plan for version upgrades as the project continues to evolve.
Copy link to headingWhich is better for RAG pipelines?
For linear RAG pipelines that follow a retrieve-prompt-generate pattern, LangChain's LCEL provides a simpler approach. LangGraph makes more sense when the RAG pipeline requires agentic retrieval with loops, human-in-the-loop approval, or state persistence across restarts.
Copy link to headingWhat is the learning curve for LangGraph compared to LangChain?
LangChain offers a lower initial barrier, with create_agent and LCEL's pipe syntax getting teams to a working agent quickly. LangGraph requires understanding graph theory, state schemas, and reducer functions upfront, which makes more sense for complex workflows.