← Back to Autonomy

A Field Guide · LLM Application Tooling

The Lang Ecosystem LangChain, LangGraph & LangSmith — explained in plain language

Three products, three confusingly similar names, one company. The hardest part of learning the LangChain ecosystem is not any single tool — it is figuring out which problem each one solves and where one ends and the next begins. This guide draws a clean line through all three, in the simplest terms, with the practical caveats that only show up once you start building.

All three are built by the same team (LangChain, Inc.), and they stack neatly on top of one another. The cleanest mental model is to think of them as three layers of a single workshop: a parts bin, an assembly line that can loop back on itself, and a test bench with a logging scope. Once that picture is in place, everything else falls into position.

YOUR LLM APPLICATION LangChain The parts bin — models, prompts, tools, retrievers, memory, embeddings, parsers. LangGraph The assembly line that can loop back — nodes, edges, shared state, branches, retries. LangChain's agents now run on LangGraph ↑ Model providers & data Claude · GPT · open-source models · vector stores · APIs swap freely — code stays the same LangSmith the scope WATCHES EVERYTHING
Figure 1. How the pieces stack. LangChain supplies the components; LangGraph wires them into a controllable flow with loops and memory; LangSmith observes the whole thing from the outside — and works even when the other two aren't used.
Section 01

BuildLangChain

— the building blocks for talking to a model.

LangChain is the original open-source framework, released in late 2022. Its core job is to give you a standard set of components for building LLM applications, plus a universal adapter over model providers. Write your logic once, and you can swap Claude for GPT for an open-source model by changing a line — the surrounding code doesn't move.

The name comes from "chaining": you connect small pieces into a pipeline. A typical chain takes a question, drops it into a prompt template, sends it to a model, and parses the answer into clean output. The main building blocks are:

Plain-language analogy LangChain is the parts bin and the wiring standard. Like a library of pre-built blocks plus a common connector spec, it means every component plugs into every other — and you don't rebuild a model adapter each time you change vendors.
# A minimal chain: prompt → model → text
from langchain.chat_models import init_chat_model
from langchain_core.prompts import ChatPromptTemplate

model  = init_chat_model("claude-sonnet-4-6", model_provider="anthropic")
prompt = ChatPromptTemplate.from_template("Explain {topic} in one sentence.")

chain  = prompt | model            # the "|" pipes one step into the next
print(chain.invoke({"topic": "field-oriented control"}).content)

Practical notes

Section 02

OrchestrateLangGraph

— for flows that loop, branch, and remember.

A plain LangChain chain runs in a straight line: A → B → C. That is fine until your app needs to think in circles — retry a failed step, decide which branch to take, call a tool and re-evaluate, or hand control between several agents. That is what LangGraph is for: it's an orchestration runtime where you describe your app as a graph.

Plain-language analogy — control-systems flavour A linear chain is open-loop: signal in, result out, no feedback. LangGraph is closed-loop with state — the output of a node can feed back into an earlier node, conditioned on the current state, exactly like a feedback path around a plant. The "shared state" is your state vector; conditional edges are your switching logic; checkpoints are your ability to freeze and resume the integrator. If you can read a block diagram, you can read a LangGraph.
# A loop: the agent calls a tool, then loops back to decide again
from langgraph.graph import StateGraph, START, END

g = StateGraph(AgentState)
g.add_node("reason", call_model)
g.add_node("act",    run_tools)

g.add_edge(START, "reason")
g.add_conditional_edges("reason", needs_tool, {"yes": "act", "no": END})
g.add_edge("act", "reason")        # ← loop back: A → B → A

app = g.compile(checkpointer=memory)   # state survives between steps
reason act done done? feedback: state updated, loop again

A straight line: each step runs once, output leaves. No feedback — like open-loop control.

Practical notes

Section 03

ObserveLangSmith

— see, test, and debug what your app actually did.

LLM apps are hard to debug because the "logic" lives in opaque model calls. LangSmith is the observability and evaluation platform that fixes this. It records a trace of every run — each step, its inputs and outputs, how long it took, how many tokens it burned, which tools fired — and lays it out as a readable execution tree.

On top of tracing it adds three things production apps need:

Plain-language analogy LangSmith is the oscilloscope and the dyno test bench for your LLM app. It doesn't build the system — it instruments it. The trace is your logged channel data; the eval suite is your repeatable test plan on a known dataset; the dashboards are your bench monitors. Same role your HiL rig plays for embedded code.
# Tracing is mostly free: set two env vars, traces appear automatically
import os
os.environ["LANGSMITH_TRACING"] = "true"
os.environ["LANGSMITH_API_KEY"] = "<your-key>"

# ...now run your LangChain / LangGraph app as normal —
# every step is captured and viewable in the LangSmith UI.
# Or instrument raw API / custom code with the @traceable decorator:
from langsmith import traceable

@traceable
def diagnose(signal): ...

What you get back looks roughly like the tree below — click the arrows to expand a step and see how a single run decomposes into model calls and tool calls, each timed and token-counted:

run · diagnose_fault  ✓1.84s · 4,210 tok
diagnose_fault1.84s · 4,210 tok
ChatAnthropic · reason0.62s · 1,180 tok
·prompt → "classify the fault…"in: 940 tok
·output → tool_call: search_logsout: 240 tok
·Tool · search_logs(dtc="P0AFA")0.31s
·Tool · fetch_flux_map(id=590)0.18s
ChatAnthropic · reason (loop 2)0.73s · 1,610 tok
·output → "likely cause: saturated table…"out: 320 tok

Practical notes

Section 04

At a glance — which one, when

The fastest way to keep them straight: each answers a different question about your application.

The three tools, compared
Tool One-line job Reach for it when… Nature
LangChain Building blocks & a universal model adapter. You want to assemble an app fast from standard pieces — RAG, chatbot, summarizer — and stay model-agnostic. Open-source framework (MIT)
LangGraph Orchestration with loops, branches & state. Your flow must loop, retry, branch, persist, or coordinate several agents over a long run. Open-source runtime (MIT)
LangSmith See, test & debug what ran. You need to trace, evaluate, regression-test, or monitor — in dev or production, with any framework. Commercial platform
The one-sentence summary LangChain builds it, LangGraph controls how it flows, LangSmith tells you what it actually did. You can use any one without the others — but they're designed to click together.
Section 05

The wider family

The three names above are only the core. A reader skimming the docs will trip over half a dozen more. They sort into two groups: an abstraction ladder of frameworks, and a set of deployment & visual tools.

The abstraction ladder

The cleanest way to think about the open-source frameworks is as rungs of increasing convenience and decreasing control. You climb up for speed and down for control — and you can mix them, since each rung is built on the one below.

harness · highest level DeepAgents
Opinionated, batteries-included agents — built-in planning (a to-do tool), persistent memory, sub-agents, a virtual filesystem, and skills. Reach for it to stand up a capable autonomous agent fast.
runtime · mid level LangGraph
The orchestration runtime underneath. Drop here when you need to control every node, edge, and state transition yourself.
components · foundation LangChain
The building blocks and model adapters everything else is assembled from.

DeepAgents is a standalone library that sits on LangChain's building blocks and uses the LangGraph runtime for durable execution and human-in-the-loop. If you've built MCP-style harnesses before, it occupies the same niche as Anthropic's Claude Agent SDK — an opinionated "agent harness" rather than a low-level framework.

Deployment & visual tools

Migration sidebar — the v0 → v1 churn The ecosystem moved fast and broke things along the way. The big reset came with LangChain 1.0 and LangGraph 1.0 (late 2025): LangChain refocused on a core agent loop with a new middleware concept, and the old langgraph.prebuilt module was deprecated, with its functionality moved into langchain.agents. The team has committed to no breaking changes until 2.0 — so 1.x is finally a stable base. Practical takeaway: any tutorial written before late 2025 may use moved-or-renamed APIs (and pre-1.0 memory classes). Pin your versions and cross-check against the live docs.
Section 06

Beyond the Lang stack

The Lang ecosystem is popular, not mandatory. It helps to know the neighbors — several are simpler, and for some jobs they're the better fit. A high-level map of the current landscape:

Notable alternatives & where they shine
ToolWhat it isSweet spot
LlamaIndexA data framework focused on indexing and retrieval.RAG over your own documents, where ingestion and retrieval quality is the whole game.
HaystackAn open-source NLP/search pipeline framework (by deepset).Production search and RAG with a pipeline-first, well-documented design.
CrewAIA framework for teams of role-playing agents.Multi-agent automations expressed as a "crew" with assigned roles and tasks.
Microsoft AutoGenMulti-agent conversation framework (strong .NET story).Enterprise multi-agent pipelines, especially in Microsoft-centric stacks.
PydanticAIA type-safe agent framework from the Pydantic team.Teams who want strict typed inputs/outputs and minimal magic.
SmolAgentsA lightweight, code-first agent library (Hugging Face).Rapid prototyping and small code-generating agents.
Vercel AI SDKA TypeScript-first toolkit for AI apps.Streaming LLM features in JS/TS web apps and frontends.
Provider SDKsNative agent SDKs from model makers — Anthropic's Claude Agent SDK, OpenAI's Agents SDK.When you want the model vendor's own opinionated harness with the least abstraction between you and the API — the path you took on your own agents.
LangfuseOpen-source observability (the LangSmith alternative).Tracing/eval/prompt management on your own infra, OpenTelemetry-friendly, no vendor lock-in.

None of these is strictly "better" — they trade convenience against control and lock-in differently. The honest summary: LangChain/LangGraph win on breadth of integrations and a single coherent stack; the alternatives often win on simplicity, type-safety, or staying close to the metal.

Section 07

When not to reach for them

The most common mistake isn't picking the wrong Lang tool — it's reaching for one at all when a plain API call would do. A surprising share of "AI features" need no agent runtime: they need one prompt, one model call, and maybe a retrieval step. Wrapping that in an orchestration framework adds dependencies, indirection, and a debugging surface you didn't need.

More than one model call, or any tool use? NO Just the provider API YES Need loops, branching, retries, or persistent state? NO LangChain YES Want planning, sub-agents & memory out of the box? NO LangGraph YES DeepAgents (or a provider SDK) LangSmith add at any layer, anytime
Figure 2. A rough decision path. Observability (LangSmith or Langfuse) is orthogonal — bolt it on at whatever layer you land.

Honest caveats

Section 08

Talking to MCP

Since you work in MCP and agent-tooling terms, the natural question is how the Lang stack relates to the Model Context Protocol. They're complementary, not competing: MCP is a standard way to expose tools and data to any model; LangGraph is a way to orchestrate an agent that uses those tools.

The bridge is the langchain-mcp-adapters package. It wraps tools served over MCP so they look like ordinary LangChain tools — which means a LangGraph agent can call any MCP server's tools with no special handling. You point the adapter at one or more MCP servers, it discovers their tools, and your agent treats them like native functions.

# Expose MCP-served tools to a LangGraph agent
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent

client = MultiServerMCPClient({
    "diagnostics": {"url": "http://localhost:8000/mcp", "transport": "streamable_http"},
})
tools = await client.get_tools()      # MCP tools → LangChain tools
agent = create_agent("claude-sonnet-4-6", tools)

So your existing MCP servers don't get thrown away if you adopt LangGraph — they plug straight in. And the reverse holds too: you can keep orchestrating with the provider SDK and still consume the same MCP tools. MCP is the connector standard; the framework is just the conductor.

Section 09

All three in one workflow

Concretely, picture an autonomous diagnostics agent — the kind of thing close to your VHM world. A fault report comes in; the agent must search records, read relevant documents, reason about a likely cause, and verify before it commits to an answer. Here's how the layers divide the labor:

One complete (illustrative) example

Stitched together, a minimal version is short — the heavy lifting is in the prebuilt agent loop. This is the high-level path (LangChain's create_agent, which runs on LangGraph); observability switches on with two env vars.

# pip install langchain langgraph langsmith
import os
os.environ["LANGSMITH_TRACING"] = "true"          # ← LangSmith: trace everything
os.environ["LANGSMITH_API_KEY"] = "<key>"

from langchain.agents import create_agent       # high-level loop (on LangGraph)
from langchain_core.tools import tool
from langgraph.checkpoint.memory import InMemorySaver

# --- LangChain: define the tools the agent may call ---
@tool
def search_logs(dtc: str) -> str:
    """Return recent log lines for a diagnostic trouble code."""
    return query_fleet_db(dtc)

@tool
def fetch_flux_map(motor_id: int) -> str:
    """Return the flux-map summary for a motor."""
    return load_flux_map(motor_id)

# --- LangGraph: the checkpointer gives durable, resumable state ---
agent = create_agent(
    "claude-sonnet-4-6",
    tools=[search_logs, fetch_flux_map],
    system_prompt="You are a powertrain diagnostics assistant. "
                  "Gather evidence with tools before concluding.",
    checkpointer=InMemorySaver(),          # swap for a DB saver in prod
)

# --- Run it. The reason→act→reason loop happens inside; ---
# --- every step is auto-traced to LangSmith. ---
result = agent.invoke(
    {"messages": [("user", "P0AFA on motor 590 — likely cause?")]},
    config={"configurable": {"thread_id": "case-4471"}},
)
print(result["messages"][-1].content)

That's the whole point of the stack in one screen: components define what the agent can do, the runtime handles how the loop and state behave, and observability shows you what actually happened — all without you hand-writing the agent loop, the retry logic, or the logging.

None of the three is a complete app on its own. Together they cover the full lifecycle — compose, orchestrate, observe — which is precisely the gap that opened up once LLM apps grew past single prompt-and-response calls.

Appendix A

Glossary

The terms that show up constantly once you start reading the docs:

Agent
An LLM given tools and a loop, so it can decide which actions to take rather than following a fixed script.
Tool calling
The mechanism by which a model requests a specific function (search, calculator, an API) with structured arguments, and receives the result back.
RAG (retrieval-augmented generation)
Fetching relevant text from your own data and feeding it into the prompt, so the model answers from your documents instead of memory alone.
Embeddings
Numeric vectors representing the meaning of text, so similar passages sit near each other and can be found by similarity.
Vector store
A database for embeddings that answers "which chunks are most similar to this query" — the retrieval engine behind RAG.
State
The shared working memory passed between nodes in a LangGraph — the equivalent of a state vector flowing through a control loop.
Checkpoint
A saved snapshot of that state, enabling pause/resume, crash recovery, and human-in-the-loop approval.
Human-in-the-loop
Pausing the agent at a chosen point so a person can review, edit, or approve before it continues.
Trace
The full recorded execution of one run — every step, input, output, latency, and token count — as captured by LangSmith.
Eval
Scoring outputs against a dataset of known cases, so you can measure quality and catch regressions when you change something.
Middleware
LangChain 1.0's hook concept for customizing the agent loop — injecting steps like summarization or guardrails around model calls.
Harness
A higher-level, opinionated agent package (DeepAgents, a provider's Agent SDK) that bundles planning, memory, and sub-agents on top of a runtime.
Appendix B

References & further reading

  1. LangChain — official documentation and conceptual guides. https://docs.langchain.com
  2. LangGraph — overview, graph runtime, durable execution, human-in-the-loop. https://docs.langchain.com/oss/python/langgraph/overview
  3. LangChain & LangGraph reach v1.0 — milestone announcement (Oct 2025). https://www.langchain.com/blog/langchain-langgraph-1dot0
  4. LangSmith — product page and tracing / evaluation docs. https://www.langchain.com/langsmith · https://docs.langchain.com/langsmith/home
  5. Unified API reference across the ecosystem (Python & TypeScript). https://reference.langchain.com
  6. LangChain — encyclopedic background, history, and licensing summary. https://en.wikipedia.org/wiki/LangChain
  7. Comparison: LangChain vs LangGraph vs LangSmith vs LangFlow — DataCamp tutorial. datacamp.com/tutorial/langchain-vs-langgraph-vs-langsmith-vs-langflow
  8. Langfuse vs LangSmith — open-source observability alternative (vendor-risk discussion). huggingface.co/blog · "Langfuse vs LangSmith vs LangChain (2025)"
  9. Deep Agents — overview of the higher-level agent harness (planning, sub-agents, memory). https://docs.langchain.com/oss/python/deepagents/overview
  10. LangGraph (GitHub) — runtime overview, and its relationship to Deep Agents & LangSmith. https://github.com/langchain-ai/langgraph
  11. LangServe deprecation & LangGraph Platform deployment tiers. github.com/langchain-ai/langserve · speakeasy.com agent-framework comparison
  12. Agent-framework landscape — LangChain vs LangGraph vs CrewAI vs PydanticAI vs Mastra vs Vercel AI SDK. https://www.speakeasy.com/blog/ai-agent-framework-comparison
  13. langchain-mcp-adapters — bridging MCP-served tools into LangChain / LangGraph agents. pypi.org/project/langchain-mcp-adapters · github.com/langchain-ai/langchain-mcp-adapters

Note — the ecosystem moves quickly. Version facts (LangChain/LangGraph v1.0, the May 2025 LangGraph Platform GA) are current as of mid-2025/late-2025 sources; confirm exact API surfaces against the live docs before building, as helper names such as create_agent have shifted between releases.


By Majid Mazouchi · Compose → Orchestrate → Observe