LangChain

Framework · Last verified 2026-09-30

TL;DR

LangChain is LangChain Inc.'s MIT-licensed Python framework for LLM applications and agents. Version 1 centers on create_agent, a tool-calling agent built on LangGraph and extended with middleware, plus provider integrations for models, tools and vector stores. It suits developers who want a standard agent loop with many ready integrations.

Key facts

LangChain key facts. Data as of 2026-09-30.
Type Framework
Languages / SDKs Python
License MIT
Pricing model Open core
Orchestration pattern Supervisor
GitHub stars 147,295 (as of 2026-09-30)
GitHub forks 24,662
Last push 2026-09-30
Latest release langchain-core==1.6.6
Repository langchain-ai/langchain
Website www.langchain.com
Documentation docs.langchain.com
Last verified 2026-09-30

Key features

  • create_agent: a configurable tool-calling agent assembled from a model, tools, a system prompt and middleware. (source)
  • Prebuilt middleware such as human-in-the-loop, summarization, PII handling, call limits, model fallback and to-do lists. (source)
  • Documented multi-agent patterns: subagents as tools, handoffs, on-demand skills, routers and custom LangGraph workflows. (source)
  • Short-term memory through LangGraph checkpointers keyed by thread ID. (source)
  • Long-term memory through LangGraph stores that persist across threads. (source)
  • Built-in MCP client (langchain.mcp.MCPAdapter, built on FastMCP) for loading MCP server tools. (source)
  • Provider integrations shipped as separate packages, for example langchain-openai and langchain-anthropic. (source)

Architecture and orchestration pattern

Pattern: Supervisor

In v1 the langchain package was trimmed to agent building blocks, with older chains, retrievers and the indexing API moved to langchain-classic. The central API is create_agent, which returns a LangGraph graph that loops between the model and tools. Middleware hooks into that loop to change prompts, filter tools, summarize history, enforce limits or pause for approval.

Multi-agent systems are built from these agents. The docs list five patterns: subagents (a main agent calls other agents wrapped as tools and keeps control), handoffs (tool calls change state that switches the active agent or its configuration), skills loaded on demand, routers that classify and dispatch, and custom workflows written directly in LangGraph. For a batteries-included option the docs point to Deep Agents, which is built on LangChain.

State comes from LangGraph: a checkpointer gives thread-level short-term memory and makes interrupts possible, and a store provides long-term memory across threads.

Human in the loop

HumanInTheLoopMiddleware checks each proposed tool call against an interrupt_on policy. When a call needs review, the middleware raises a LangGraph interrupt and the agent state is saved by the checkpointer. A person then answers each pending action with approve, edit (change the arguments), reject (skip with feedback) or respond (reply in place of an ask-the-user tool), and the run resumes with those decisions in order. A checkpointer and thread ID are required. The docs also cover rendering these approvals in a frontend.

Protocols

MCP, A2A and AG-UI support for LangChain. See the full matrix.
ProtocolSupportNote
MCP Yes evidence
checked 2026-09-30
Client: MCPAdapter in the langchain.mcp namespace (langchain[mcp]>=1.4.0, marked beta) loads MCP server tools; it replaces the standalone langchain-mcp-adapters package.
A2A Yes evidence
checked 2026-09-30
Server side via Agent Server: a deployed LangChain or LangGraph agent is reachable at /a2a/{assistant_id}; the docs' examples include a LangChain agent talking to a Google ADK agent.
AG-UI Partial evidence
checked 2026-09-30
LangChain docs show CopilotKitMiddleware plus the external ag-ui-langgraph bridge exposing a create_agent graph over AG-UI; AG-UI is not built into LangChain itself.

Best for

  • Tool-calling agents that need many ready-made model, tool and vector store integrations
  • Research and retrieval assistants that combine search tools with subagents
  • Agents whose sensitive tool calls must be approved, edited or rejected by a person
  • Support assistants that switch between specialist configurations with handoffs

Not for

  • Code that still depends on legacy chains or retrievers without adding langchain-classic
  • Workflows needing fine-grained control of every step, where the docs point to LangGraph instead
  • TypeScript projects, which use the separate LangChain.js library

Quickstart

pip install -U langchain

Install not yet verified by this site. What this means

from langchain.agents import create_agent
from langchain.tools import tool

researcher = create_agent(model="openai:gpt-5.5",
                          system_prompt="Answer with three short factual bullet points.")

@tool
def research(question: str) -> str:
    """Ask the research subagent a factual question."""
    result = researcher.invoke({"messages": [{"role": "user", "content": question}]})
    return result["messages"][-1].content

writer = create_agent(model="openai:gpt-5.5", tools=[research],
                      system_prompt="Call research() for facts, then write one paragraph.")

# needs OPENAI_API_KEY and `pip install "langchain[openai]"`
out = writer.invoke({"messages": [{"role": "user", "content": "Explain the A2A protocol."}]})
print(out["messages"][-1].content)

Common pitfalls

  • Requires Python 3.10+; v1 dropped Python 3.9.
  • Model providers are separate packages or extras (langchain-openai, langchain[openai]) and need their API key, for example OPENAI_API_KEY.
  • Legacy chains, retrievers, the indexing API and langchain-community exports moved to langchain-classic in v1.
  • langgraph.prebuilt.create_react_agent is superseded by create_agent; follow the v1 migration guide.
  • The built-in langchain.mcp namespace is beta and emits a LangChainBetaWarning; code on langchain-mcp-adapters has a migration guide.
  • Human-in-the-loop middleware needs a checkpointer and a thread ID to pause and resume.

Official quickstart

Pros

  • A single create_agent entry point, customised through middleware rather than subclassing. (source)
  • Human review supports approve, edit, reject and respond decisions per tool call. (source)
  • The docs compare five multi-agent patterns and say when a single agent is enough. (source)
  • Many prebuilt middleware components cover summarization, PII, limits and fallbacks. (source)
  • Agents run on LangGraph, so a checkpointer gives thread-level memory and resumable interrupts. (source)

Cons

  • v1 moved legacy chains, retrievers and the indexing API into langchain-classic, so older code needs an extra package or a rewrite. (source)
  • v1 dropped Python 3.9 and changed several APIs, documented in a long migration guide. (source)
  • The new built-in MCP namespace is beta and may change. (source)
  • AG-UI support relies on CopilotKit's middleware and a separate bridge package. (source)
  • Managed deployment and team tracing are LangSmith features, with deployment access starting on a paid plan. (source)

Alternatives

FAQ

Does LangChain support MCP?

Yes. MCPAdapter in langchain.mcp (beta, langchain[mcp]>=1.4.0) loads tools from MCP servers into agents; it replaces the older langchain-mcp-adapters package.

How is LangChain different from LangGraph?

LangChain's create_agent is a ready-made agent loop built on LangGraph, customised with middleware. LangGraph is the lower-level runtime for writing your own graphs.

Is LangChain free?

The library is MIT-licensed. LangChain Inc. sells LangSmith for tracing, evaluation and deployment, with a free developer tier and paid plans.

Is there a JavaScript version?

Yes. LangChain.js is a separate repository (langchain-ai/langchainjs); this record covers the Python package.

Where did chains and retrievers go in v1?

Into langchain-classic, which holds legacy chains, retrievers, the indexing API, the hub module and langchain-community exports.

Sources