LangChain vs LangGraph vs LangSmith Explained: What Each One Does, When to Use It, and a Full Example (2026)

LangChain, LangGraph, and LangSmith are three separate but complementary tools from the same company (LangChain Inc.), not three versions of the same thing. LangChain gives you the building blocks and the create_agent constructor to wire up an LLM app quickly. LangGraph is the lower-level graph-based runtime — the one LangChain's own agent constructor runs on under the hood — for anything that needs loops, branching, human approval steps, or durable state. LangSmith is the framework-agnostic observability and evaluation layer that traces, tests, and monitors whatever you built with the other two. Use LangChain to ship fast, LangGraph when you outgrow a simple agent loop, and LangSmith to see what's actually happening in production.

What LangChain, LangGraph, and LangSmith Actually Are

All three ship from LangChain Inc., and the confusion around them mostly comes from the fact that they used to be one sprawling package. Since LangChain's v1.0 release on October 22, 2025, the boundaries are much sharper.

LangChain is the agent-building framework: provider-agnostic model integrations, tool definitions, prompt utilities, and — as of v1.0 — the create_agent function, which replaced the long-deprecated AgentExecutor. Legacy pieces like AgentExecutor, LLMChain, and ConversationBufferMemory were moved out of the core package entirely into a separate langchain-classic package, so the main langchain package today is deliberately thin.

LangGraph is the orchestration runtime underneath. It models an agent as a graph: nodes are steps (an LLM call, a tool call, a conditional check), edges define how control moves between them, and a shared state object persists across the whole run. create_agent in LangChain actually compiles down to a LangGraph graph — you don't see the graph unless you need to, but it's there the moment you need loops, retries, or a pause for human review.

LangSmith is the observability and evaluation platform. It's framework-agnostic — it will trace calls even if you aren't using LangChain or LangGraph at all — but it's built to plug into both with a single environment variable. Every LLM call, tool call, and graph step becomes a nested, replayable trace, and you can build evaluation datasets to catch regressions before they ship.

Diagram of the core LangChain agent loop showing the model responding with either tool calls or a final answer
Source: LangChain & LangGraph Reach v1.0, LangChain blog

LangChain vs LangGraph vs LangSmith: Quick Comparison

ToolWhat it isBest forNot ideal for
LangChainAgent framework: models, tools, prompts, create_agentShipping a straightforward agent or RAG pipeline fast, provider-agnostic model swappingComplex branching, multi-agent handoffs, resuming after a crash
LangGraphGraph-based orchestration runtime with persistenceLoops, conditional routing, human-in-the-loop approval gates, multi-agent supervisor systems, durable/resumable executionA simple one-shot question-answer bot where a graph is overkill
LangSmithTracing, evaluation, and monitoring platformDebugging a misbehaving agent step-by-step, regression-testing prompt or model changes, tracking latency/cost/quality in productionBuilding the app itself — it observes, it doesn't execute

LangChain in Detail: The Agent-Building Layer

As of v1.0, building an agent in LangChain looks like this:

from langchain.agents import create_agent

agent = create_agent(
    model="claude-sonnet-4-6",
    tools=[search_tool, lookup_order_tool],
    system_prompt="You are a helpful support agent."
)

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

Two things changed from the pre-1.0 API that trip people up during migration: the prompt argument was renamed to system_prompt, and pre/post-model hooks were replaced by a proper middleware system with before_model and after_model methods, so cross-cutting behavior (guardrails, logging, retries) is now a reusable, composable unit instead of a one-off callback. LangChain's own guidance is direct about when to stop here: create_agent is the right abstraction until you need to intercept state mid-execution, add a human review step, implement conditional retry logic, or hand off between multiple agents — at which point you drop down to LangGraph's explicit StateGraph.

LangGraph in Detail: The Orchestration Layer

LangGraph earns its keep the moment an agent stops being a straight line. A StateGraph is built from nodes and edges over a shared state object:

from langgraph.graph import StateGraph, START, END
from typing import TypedDict

class AgentState(TypedDict):
    messages: list
    needs_approval: bool

def call_model(state: AgentState) -> AgentState:
    ...
    return state

def route(state: AgentState) -> str:
    return "human_review" if state["needs_approval"] else END

graph = StateGraph(AgentState)
graph.add_node("agent", call_model)
graph.add_node("human_review", human_review_node)
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", route)

app = graph.compile(checkpointer=InMemorySaver())

The checkpointer is what makes this durable: LangGraph's persistence layer saves state at every step, so a run can pause — waiting on a human approval, a rate limit, or a server restart — and resume exactly where it left off instead of starting over. That same persistence layer underpins two of LangGraph's most-used patterns: human-in-the-loop middleware, which pauses execution before a risky tool call (like issuing a refund) until a person approves it, and the supervisor pattern (via the langgraph-supervisor package), where a central supervisor agent routes each incoming request to the right specialized sub-agent and manages all communication between them.

LangSmith in Detail: The Observability Layer

Turning on tracing for either LangChain or LangGraph is a matter of setting environment variables — no code changes to the agent itself:

export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY="your-api-key"
export LANGSMITH_PROJECT="support-agent"

From there, every LLM call, tool call, and graph node execution shows up as a nested, replayable trace with inputs, outputs, latency, and token cost at each step — which is what makes debugging a multi-step LangGraph agent tractable instead of guesswork. Beyond live tracing, LangSmith lets you build evaluation datasets, define evaluators (LLM-as-judge, custom code, or human review), and run experiments that flag regressions when you change a prompt or swap a model.

Pricing has a genuinely usable free tier: the Developer plan gives 5,000 traces/month, 14-day retention, and one seat at no cost. The Plus plan is $39 per seat/month with 10,000 base traces included (14-day retention) and overage at $2.50 per 1,000 traces, or $5.00 per 1,000 for extended 400-day retention. Enterprise is custom-priced and adds SSO, dedicated support, and custom retention policies.

Putting It Together: A Worked Example

Here's how the three tools stack in a real support-agent scenario — an agent that looks up orders on its own but must pause for human sign-off before issuing a refund.

1. Start with LangChain's create_agent

Define the model, the tools (order lookup, refund issuance), and a system prompt using create_agent. For a huge share of support-bot traffic — "where's my order," "what's your return policy" — this alone is the entire app.

2. Drop to LangGraph when a refund is requested

Wrap the refund tool call with LangGraph's human-in-the-loop middleware. When the agent decides to call issue_refund, the graph interrupts, persists its state via a checkpointer, and waits. A support lead approves or rejects in a review queue; the graph resumes from that exact point — it doesn't replay the whole conversation.

3. Add a second specialized agent behind a supervisor

If billing questions and technical troubleshooting need genuinely different tool sets and prompts, split them into two sub-agents and put a LangGraph supervisor in front to route each incoming message to the right one.

4. Trace and evaluate everything with LangSmith

With LANGSMITH_TRACING=true set, every step above — the initial LangChain agent call, the LangGraph interrupt and resume, the supervisor's routing decision — lands as one connected trace. Build a LangSmith dataset from real support transcripts, run an LLM-as-judge evaluator against it after every prompt change, and let it flag when a "fix" to the refund flow quietly broke the order-lookup flow.

That's the whole stack: LangChain to build it fast, LangGraph the moment it needs to branch, pause, or hand off, and LangSmith to prove it still works after the next change.

FAQ

Is LangGraph a replacement for LangChain?

No. LangGraph is built by the same company and LangChain's own create_agent function runs on top of LangGraph internally. They're complementary layers, not competitors — LangChain gives you the quick-start agent constructor, LangGraph gives you the graph runtime underneath it when you need more control.

Do I need LangSmith to use LangChain or LangGraph?

No, LangSmith is optional and framework-agnostic. You can run LangChain or LangGraph agents with zero LangSmith integration. Tracing turns on by setting a couple of environment variables, and it works even for LLM calls that don't go through LangChain at all.

What happened to AgentExecutor?

It's deprecated. AgentExecutor was deprecated back in LangChain 0.2 (May 2024) and, with the 1.0 release in October 2025, it was moved out of the core langchain package entirely into a separate langchain-classic package. New agents should use create_agent.

When should I use LangGraph instead of plain create_agent?

Once you need something the single agent loop can't express: conditional branching between different tool sets, a human approval gate before a risky action, multi-agent handoffs, or the ability to resume a long-running agent after a crash or restart. Below that threshold, create_agent alone is simpler and sufficient.

Is LangSmith free?

There's a genuinely usable free Developer plan: 5,000 traces per month, 14-day retention, one seat. Paid plans start at $39/seat/month (Plus) with overage billed per 1,000 additional traces, and Enterprise is custom-priced for teams needing SSO or custom retention.

Can I use LangGraph without LangChain?

Yes. LangGraph is a standalone graph orchestration library — you can build a StateGraph and call any model API directly inside a node without going through LangChain's model integrations at all, though most teams use both together since LangChain's tool and model abstractions save boilerplate.

What's the difference between a LangGraph checkpointer and LangSmith tracing?

They solve different problems. A checkpointer persists an agent's state so a run can pause and resume — it's about durability and recovery. LangSmith tracing records what happened at each step for debugging and evaluation — it's about observability. You typically want both on any production agent.


Further reading:

No comments

Post a Comment