What Is LangChain? LangChain vs LangGraph Explained

LangChain is an open-source framework for building applications and agents on top of language models, in Python and JavaScript. What it is made of today, how it relates to LangGraph and LangSmith, a working example, and when a provider’s own SDK is the simpler choice.

7 min read

LangChain is an open-source framework, in Python and JavaScript, for building applications and agents on top of language models. It gives you one interface to many model providers, a way to turn your functions into tools a model can call, and a ready-made agent loop, create_agent, that calls the model, runs the tools it asks for and stops when it has an answer. Underneath sits LangGraph, a lower-level runtime for long-running, stateful agents, and beside it sits LangSmith, a hosted service for tracing and evaluating what your agent did. Use LangChain when you want to switch models freely or need its integrations; use a provider’s own SDK when you are committed to one provider and want the fewest layers between you and the API.

Older tutorials describe LangChain as a library for “chains” of prompts. That was true before version 1. Today the main package is built around agents, and the chain-era features have moved to a separate package. If what you have read does not match the current docs, that is usually why.

What LangChain is today

LangChain’s own overview (opens in a new tab) presents create_agent as a minimal, highly configurable agent harness, summed up as “Agent = Model + Harness.” The model is any chat model LangChain supports, named with a provider prefix such as anthropic: or openai:. The harness is the loop, plus middleware you can add for dynamic prompts, summarizing long conversations and guardrails. The same overview says LangChain agents are built on top of LangGraph, and points you to LangGraph when you need durable execution, human-in-the-loop pauses or persistence beyond what the agent gives you.

The packages, and what each one is for

  • langchain: the agent framework. create_agent, tools, middleware and structured output. Since version 1 it is deliberately small and re-exports the core types for convenience.
  • langchain-core: the foundation the others share, such as messages, tools and embeddings. You rarely install it on its own; it comes with everything else.
  • Partner packages such as langchain-anthropic and langchain-openai: one per provider, installed through extras like langchain[anthropic].
  • langchain-classic: the legacy features moved out at version 1, including chains, retrievers, the hub and the indexing API. Install it only if old code needs it.
  • langgraph: the orchestration runtime. Graphs of steps over shared state, checkpoints, pauses for a person and resuming after a failure.
  • LangSmith: not a library you build with but a hosted service for traces, evaluations and monitoring. LangChain says it works with many frameworks and providers, not only its own.

Both frameworks are on major version 1. LangChain’s release policy (opens in a new tab) follows semantic versioning, calls LangChain and LangGraph 1.0 long-term support releases that stay active until 2.0 ships, and says the legacy LangChain 0.3 and LangGraph 0.4 lines are in maintenance mode until December 2026. As of October 1, 2026, the newest Python releases on PyPI are langchain 1.4.3, langchain-core 1.6.6 and langgraph 1.2.12. If you are still on 0.3, plan the move now.

A LangChain agent in a few lines

This is the quickstart from LangChain’s docs, with the model switched to Claude Sonnet 5.5. The docs use an OpenAI model; any supported provider works by changing the string and the extra you install.

Python
# pip install -U langchain "langchain[anthropic]"
from langchain.agents import create_agent

def get_weather(city: str) -> str:
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

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

result = agent.invoke(
    {"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}
)
print(result["messages"][-1].content_blocks)

Three things happen there that you would otherwise write yourself. The function’s type hints and docstring become the tool’s schema and description. The loop sends the question, sees the model ask for get_weather, runs it, and sends the result back. And content_blocks gives you the reply in LangChain’s standard format, whichever provider answered.

LangChain vs LangGraph

They are layers, not rivals. The LangGraph overview (opens in a new tab) calls LangChain the agent framework, with abstractions and integrations for models, tools and agent loops, and LangGraph the orchestration runtime, with durable execution, streaming, human-in-the-loop and persistence. It also says you do not need LangChain to use LangGraph: its nodes are plain functions, and you can call any SDK inside them.

  • Start with LangChain’s create_agent when the job is one agent with a handful of tools and a conversation.
  • Move to LangGraph when the work has a shape you want to control: fixed steps around a model call, branches, several agents, a pause of hours for someone to approve, or a run that must resume exactly where it failed.
  • Use both when you want LangGraph’s control with LangChain’s model and tool integrations inside the nodes, which is the most common combination.

How LangGraph compares with another multi-agent framework, with code for both, is in LangGraph vs CrewAI.

LangChain or a provider SDK?

Every major model provider now ships its own agent toolkit, so LangChain is a choice rather than a default. The question is what you gain from the extra layer.

  • Choose LangChain when you expect to switch or mix providers, want its integrations with vector stores and document loaders, or want LangGraph’s checkpoints and pauses underneath your agent.
  • Choose a provider SDK when you are building on one provider, want its newest features the day they ship, and would rather read one vendor’s docs than two sets.
  • Choose no framework when the job is a single model call, or a short loop you can write and test in an afternoon.

The alternatives, one line each:

MCP in LangChain, and the legacy label

LangChain can load tools from any MCP server and hand them to an agent as ordinary tools. In Python that now lives in the langchain.mcp namespace, with an MCPAdapter built on FastMCP; the docs say it needs langchain[mcp] 1.4.0 or later and is in beta. On the JavaScript side, LangChain’s MCP page (opens in a new tab) is labeled “Legacy MCP documentation for the langchain-mcp-adapters package” as of October 1, 2026, and does not point to a replacement. Check the label for your language before you build on it. When to write a LangChain tool and when to build an MCP server instead is covered in MCP vs LangChain tools.

LangChain on GitHub

The Python framework lives in the langchain repository (opens in a new tab) under the MIT license, with the JavaScript version in a sibling repository, langchainjs, and LangGraph in its own. The code is free to use, change and ship. LangSmith is a separate hosted product with its own sign-up; the framework does not require it, and tracing can go elsewhere.

A checklist before you adopt it

  1. Write down which providers you will call in the next year. One provider weakens the case for LangChain; two or more strengthens it.
  2. Check that every integration you need is in the current docs, not only in an old tutorial or in langchain-classic.
  3. Pin langchain, langchain-core and your partner packages together, and read the release notes before a minor upgrade.
  4. Decide where traces go before the first real user: LangSmith, another tracing tool, or your own logs.
  5. If any step needs a person’s approval, plan for LangGraph from the start rather than retrofitting it.
  6. Check the status of anything you depend on, such as beta namespaces and pages marked legacy.
  7. Write a ten-line version without the framework first. If it is enough, keep it.

Where a LangChain agent reports its work

A LangChain agent can do the work, and LangSmith can show you every call it made, but neither is where your team looks to see what was asked for and what got done. fenbs is a task board that is also an MCP server, at https://fenbs.ai/api/mcp, so a LangChain agent can load its tools through the MCP adapter and use them like any others: fenbs_create_item to file a bug it found, fenbs_comment to say what it changed, fenbs_update_item to move a task to Completed and set its test status and test notes. A script cannot open a browser, so it signs in with a token you issue under Settings, with a name, the scopes you tick and an optional expiry. History records each change under the assistant’s name. fenbs does not run, trace or resume your agent; it is the record of the tasks, not the runtime.

Related

Connecting any assistant: the MCP docs and assistant tokens and scopes. Choosing a model to run it on: open-source LLMs and what an LLM is. Code that agents write: AI code generators.

Questions people ask.

Is LangChain free and open source?

Yes. The LangChain and LangGraph frameworks are open source under the MIT license, in Python and JavaScript. LangSmith, the tracing and evaluation service from the same company, is a separate hosted product with its own sign-up, and the frameworks run without it.

What is the difference between LangChain and LangGraph?

LangChain is the agent framework: model integrations, tools and a ready-made agent loop called create_agent. LangGraph is the runtime underneath it: graphs of steps over shared state, checkpoints, pauses for a person and resuming after a failure. LangChain agents are built on LangGraph, and LangGraph can be used without LangChain.

Is LangChain still worth using?

It is worth it when you call more than one model provider, need its integrations, or want LangGraph’s persistence and human-in-the-loop pauses. For a single provider and a short loop, that provider’s own SDK or no framework at all is often simpler.

Does LangChain work with Claude?

Yes. Install the Anthropic extra with pip install "langchain[anthropic]" and name the model with the anthropic: prefix, for example anthropic:claude-sonnet-5-5, in create_agent.

Start with one thing.

There is nothing to set up first. Write one line and you’ve started.