LangChain
|
This content was generated with the assistance of AI and should be verified against the official documentation of each tool and framework before being relied on in production. This section’s bibliography lists the reference material consulted while preparing these pages. |
This sub-section was written against langchain 1.4.3, langchain-core 1.6.5, langchain-classic 1.0.8, langgraph 1.2.12
and langsmith 0.14.1 on Python 3.12, langchain 1.5.14 and @langchain/langgraph 1.4.18 on npm,
and LangChain4j 1.20.2 on Java 21, with the full list in the version baseline below, all read from
PyPI, npm, Maven Central and the official documentation on 2026-09-29. Where an individual page and that baseline
ever disagree after a later update, the baseline is the one to trust. Every Python snippet on the pages was executed
against the real packages, using scripted fake chat models because no Ollama server was available, so the printed
outputs are exactly what the code prints and not what a real model would say; the few snippets that need an account
or a network service (a LangSmith workspace, a hosted model) say on their page that they were not run.
"LangChain" now names a family of libraries and services rather than one package: langchain (agents, models,
tools and middleware), langchain-core (the shared interfaces), langgraph (a durable, stateful execution runtime),
deepagents (a batteries-included agent harness), langsmith (tracing, evaluation and deployment), and, beside the
Python libraries, an independent JavaScript port and an independent Java library with its own release cadence. This
page is the map of that family, the version table, a suggested reading order for each kind of reader, and the
bibliography that all the pages draw on.
The ecosystem map
planning, filesystem, subagents"] LC["langchain
create_agent, middleware, init_chat_model"] LG["langgraph
StateGraph, checkpointers, stores, interrupt"] CO["langchain-core
messages, runnables, tools, prompts"] CL["langchain-classic
legacy chains, retrievers, indexing"] PP["partner packages
langchain-ollama, -anthropic, -openai"] MA["langchain-mcp-adapters
MultiServerMCPClient"] LS["langsmith
tracing, datasets, evaluation"] EV["openevals and agentevals
LLM-as-judge, trajectories"] AS["Agent Server
LangSmith Deployment and Studio"] JS["LangChain.js
langchain, @langchain/langgraph"] J4["LangChain4j
AiServices, agentic, MCP"] DA --> LC LC --> LG LC --> CO LG --> CO CL --> CO PP --> CO MA --> LC LC -.-> LS LG -.-> LS EV -.-> LS LG --> AS JS -. "same concepts" .- LC J4 -. "same ideas, independent code" .- LC
A solid arrow means "builds on"; a dashed arrow is an optional integration (tracing and evaluation work with or without the libraries), and a dashed line between two boxes means the two share concepts but not code. The Ecosystem & Packages page explains each package, the v1 migration table (old import to new import) and a runnable smoke test. For the official statement of what changed in the 1.0 release, see the LangChain v1 release notes and the v1 migration guide.
Python, JavaScript and LangChain4j
The three libraries solve the same problems — talk to a model, give it tools, remember a conversation, put a person in the loop, connect MCP servers, observe and test the result — but they are separate code bases. Python is the reference implementation and the primary language of this sub-section; the other two get one or two pages each.
| Python | JavaScript / TypeScript | Java (LangChain4j) | |
|---|---|---|---|
Packages |
|
|
|
Agent entry point |
|
|
|
Graph runtime |
LangGraph ( |
LangGraph.js |
none; workflows come from the |
Memory |
checkpointers (short term) and stores (long term) |
the same checkpointers and stores |
|
Observability and evaluation |
LangSmith, |
LangSmith |
model and AI Service listeners; no LangSmith integration is covered here |
Where it is covered |
every page except the two below |
Choose by the language your application is written in, not by the framework: all three call the same model providers, all three can use MCP servers, and an agent written in one can be exposed to the others over HTTP or MCP. LangChain4j is an independent open-source project, not a port of the Python code, so class names differ, and its agentic module is experimental and versioned as a beta.
Version baseline
Every version below was read from the package registries and the official documentation on 2026-09-29. Each page repeats the subset it uses in its own lead paragraph.
| Area | Versions |
|---|---|
Python |
Python 3.12; |
JavaScript |
Node.js 24 with |
Java |
Java 21; LangChain4j 1.20.2 for the stable modules and 1.20.2-beta30 for the agentic, MCP, pgvector and Spring Boot
starter modules; the Quarkiverse |
Models and stores |
Ollama with |
Material written before the 1.0 release in October 2025, including all the books in the bibliography, describes an older package layout. The differences that matter, each flagged where it appears on the pages:
-
chains, the hub,
langchain.retrievers.*and the indexing API moved tolangchain-classic, and text splitters come fromlangchain-text-splitters; -
create_agentwith middleware replaces hand-built ReAct graphs andcreate_react_agent; -
human approval is now
interrupt()withCommand(resume=…), orHumanInTheLoopMiddlewareon an agent, rather than hand-built graphs with static breakpoints; -
the tracing variables are
LANGSMITH_TRACINGandLANGSMITH_API_KEY, notLANGCHAIN_TRACING_V2; -
LangGraph Platform is now LangSmith Deployment, its server is the Agent Server, and LangGraph Studio is LangSmith Studio;
-
LangChain4j moved from the 0.3x line to 1.x, with the experimental agentic module and the MCP client added.
The running example: DocsAssistant
Every page extends DocsAssistant, the assistant that answers questions about this site’s documentation, introduced in Vector Databases & RAG and reused in LLM Foundations & Prompting, AI Agents and Model Context Protocol. It keeps the same corpus, the same Ollama models and the same pgvector store; only the framework code changes from page to page.
| Stage | What DocsAssistant does | Page |
|---|---|---|
Chat |
Answers a question with a chat model and a prompt template. |
|
Structured metadata |
Extracts typed page metadata from a document. |
|
Search tool |
Calls a |
|
Approval step |
An agent that asks a person before it opens a GitHub issue. |
|
Memory per user thread |
Remembers each user’s conversation, and durable facts across conversations. |
|
Streaming |
Streams tokens and progress to a web client. |
|
Evaluation |
Scores answers and trajectories against a dataset. |
|
Deployment |
Serves the agent from a server. |
Reading path
Read the pages in the order of the navigation on a first pass; the shorter paths below are for readers who already know part of the material.
New to LangChain 1.x
-
Ecosystem & Packages to install the right distributions.
-
Chat Models & Messages, Prompts & Templates and Structured Output.
Coming from LangChain 0.x or from the older books
-
The migration table on Ecosystem & Packages.
-
LCEL & Runnables for what remains of chains.
-
Middleware and Human-in-the-Loop & Time Travel for the replacements of the hand-built agent graphs.
Building stateful workflows and multi-agent systems
Taking an agent to production
Java developers
TypeScript developers
-
LangChain.js, using the Python pages for the concepts it shares.
What’s covered
The pages are grouped the same way as the navigation.
Core LangChain
-
Ecosystem & Packages — what each package is for, the v1 migration digest and an install smoke test.
-
Chat Models & Messages —
init_chat_model, provider packages, messages and content blocks,invoke,batchandstream, rate limiting, fallbacks and token usage. -
Prompts & Templates —
ChatPromptTemplate, message placeholders, few-shot templates and the LangSmith prompt hub. -
LCEL & Runnables — the Runnable protocol, pipe composition, parallel runnables and when to switch to LangGraph.
-
Structured Output —
with_structured_output, the agentresponse_format, output parsers and validation with retries. -
Tools — the
@tooldecorator, schemas,bind_tools, runtime injection, errors and artifacts.
Agents
-
Agents with create_agent — the agent loop, dynamic model selection and replacing
create_react_agent. -
Middleware — the hook lifecycle, built-in middleware and custom middleware.
LangGraph
-
LangGraph Fundamentals — state, reducers, nodes, edges,
Command,Sendand the functional API. -
LangGraph Workflows — prompt chaining, routing, parallelisation, orchestrator-worker and evaluator-optimizer patterns.
-
Short-Term Memory & Checkpointers — threads, checkpointers, trimming and summarising, and durable execution.
-
Long-Term Memory Stores — the store API, per-user namespaces, semantic search and retention.
-
Human-in-the-Loop & Time Travel —
interrupt, approval middleware, replay and fork, and double texting. -
Streaming — stream modes, typed events and a Server-Sent Events endpoint.
-
Multi-Agent & Deep Agents — subgraphs, supervisors, handoffs, routers, skills and the Deep Agents harness.
Integrations
-
MCP Adapters —
MultiServerMCPClientand exposing an agent as an MCP server. -
Retrieval & RAG Bridge — how the retrieval pieces fit together, with deep links into the vector-store pages.
-
Multimodality & Voice — images, PDFs and audio, and the speech-to-text, agent, text-to-speech pattern.
-
Guardrails & Security — PII handling, injection defences and tool permissions.
-
Local Models — Ollama, OpenAI-compatible servers and the tool-calling caveats of small models.
LangSmith
-
Observability with LangSmith — tracing, metadata, cost tracking, masking and OpenTelemetry.
-
Evaluation — datasets,
openevals,agentevals, online evaluators and regression experiments. -
Testing — unit tests with fake models, graph tests and integration tests.
-
Deployment —
langgraph.json, the Agent Server, Studio and self-hosting.
Other languages
-
LangChain.js — the npm package map,
createAgent, LangGraph.js and streaming to React. -
LangChain4j — the BOM,
ChatModel, AI Services, tools, memory, structured outputs, streaming and guardrails. -
LangChain4j Agents & MCP — the experimental agentic module and the MCP client.
Cheat sheet
-
Cheat Sheet (PDF) — a single-page, printable summary of the sub-section.
Related material elsewhere on this site
The vector-store side of LangChain is not repeated here. The canonical page is Integrating with LangChain, whose sections on embeddings, splitters, vector stores, retrievers, RAG chains and agentic RAG cover it, and its LangChain4j section does the same for Java. Framework-neutral background lives in the sibling sub-sections: AI Agents for agent theory, tool design, memory and evaluation, Building MCP Clients for the protocol side of the adapters, Running LLMs Locally for Ollama and other runners, and Agentic RAG and Agent Memory & Semantic Cache for the retrieval and memory patterns these libraries implement, and RAG Systems in Production for running DocsAssistant as a production RAG service. Hugging Face, Spring AI, Voice Agents, LLMOps & Evaluation and AI Security & Responsible AI are separate sub-sections of this AI section.
Bibliography
The following sources were consulted while preparing this sub-section’s pages. Every class, decorator, function, method, configuration key and environment variable was checked against the installed packages, the official documentation or the library sources listed here on 2026-09-29 — never copied from a book. Every URL cited on any page of this sub-section is listed here once.
Requester-provided books, consulted for concepts only and never the source of an example. All six predate the LangChain 1.0 release or describe an older LangChain4j line, so where they differ from a package’s own documentation, that documentation is authoritative:
-
Oshin, Mayo, and Nuno Campos. Learning LangChain: Building AI and LLM Applications with LangChain and LangGraph. O’Reilly Media, 1st ed., Feb 2025. ISBN 978-1-098-16728-8. Publisher page: https://www.oreilly.com/library/view/learning-langchain/9781098167271/. Official code repository: https://github.com/langchain-ai/learning-langchain (Python and JavaScript). Consulted as the backbone for the concepts of chat models and messages, prompt templates, the Runnable interface, LangGraph state and memory, cognitive architectures, the tool-calling agent loop, reflection and multi-agent patterns, streaming and human-in-the-loop, deployment, and testing with LangSmith.
-
Polzer, Dominik. RAG with Python Cookbook. O’Reilly Media, Apr 2026. ISBN 979-8-341-60056-0. Publisher page: https://www.oreilly.com/library/view/rag-with-python/9798341600553/. Official code repository: https://github.com/polzerdo55862/RAG-with-Python-Cookbook. Consulted for its LangChain and LangGraph recipes, including a LangGraph
StateGraphwith message reducers and an MCP client. -
Mendelevitch, Ofer, and Forrest Sheng Bao. Hands-On RAG for Production. O’Reilly Media, May 2026. ISBN 979-8-341-62171-8. Publisher page: https://www.oreilly.com/library/view/hands-on-rag-for/9798341621701/. Official code repository: https://github.com/ofermend/hands-on-rag. Consulted for LangChain agents and agent observability.
-
Anthapu, Ravindranatha, and Siddhant Agarwal. Building Neo4j-Powered Applications with LLMs. Packt Publishing, Jun 2025. ISBN 978-1-83620-623-1. Publisher page: https://www.packtpub.com/en-us/product/building-neo4j-powered-applications-with-llms-9781836206231. Official code repository: https://github.com/PacktPublishing/Building-Neo4j-Powered-Applications-with-LLMs. Consulted for LangChain4j AI Services with system messages over a graph database. It targets the 0.35 and 0.36 line, so its class and module names predate 1.x.
-
Alammar, Jay, and Maarten Grootendorst. Hands-On Large Language Models. O’Reilly Media, 2024. ISBN 978-1-098-15096-9. Publisher page: https://www.oreilly.com/library/view/hands-on-large-language/9781098150952/. Official code repository: https://github.com/HandsOnLLM/Hands-On-Large-Language-Models. Consulted for the idea of chains, conversation memory and agents; the memory classes it teaches were replaced by checkpointers, stores and message trimming.
-
Lee, Wei-Meng. Hugging Face in Action. Manning Publications, 2026. ISBN 978-1-63343-671-8. Publisher page: https://www.manning.com/books/hugging-face-in-action. Official code repository: https://github.com/weimenglee/HuggingFaceInAction. Consulted for using Hugging Face models from LangChain, message-history wrappers and LangGraph.
oreilly.com and packtpub.com answer automated fetches with an HTTP 403 response, but every publisher page above
is a live, reachable page when opened in a browser.
Official documentation, in the groups below. The pages of docs.langchain.com are cited in their Python form; the
LangChain.js pages use the same paths under /oss/javascript/.
LangChain (Python):
LangGraph (Python):
Deep Agents:
Provider and integration pages:
LangSmith:
API reference:
-
API reference — langchain-core / callbacks / base / BaseCallbackHandler
-
API reference — langchain-core / callbacks / manager / adispatch_custom_event
-
API reference — langchain-core / messages / utils / trim_messages
-
API reference — langchain-core / prompts / chat / ChatPromptTemplate
-
API reference — langchain-core / prompts / chat / MessagesPlaceholder
-
API reference — langchain-core / prompts / few_shot / FewShotChatMessagePromptTemplate
-
API reference — langchain-core / runnables / base / Runnable
-
API reference — langchain-core / runnables / base / Runnable / astream_events
-
API reference — langchain-core / runnables / base / Runnable / with_fallbacks
-
API reference — langchain-core / runnables / base / Runnable / with_retry
-
API reference — langchain-core / runnables / base / RunnableLambda
-
API reference — langchain-core / runnables / base / RunnableParallel
-
API reference — langchain-core / runnables / base / RunnableSequence
-
API reference — langchain-core / runnables / config / RunnableConfig
-
API reference — langchain-core / runnables / passthrough / RunnablePassthrough
-
API reference — langchain-core / tools / retriever / create_retriever_tool
-
API reference — langchain / agents / middleware / types / dynamic_prompt
-
API reference — langchain / chat_models / base / init_chat_model
LangChain.js:
LangChain4j:
Evaluation packages, adapters and demos (repositories):
Specifications and standards:
Model, provider and tooling documentation:
Observability alternatives:
Papers and engineering articles:
These books are consulted references, not the primary source of any example on this sub-section’s pages. On any discrepancy between a book and a package’s or framework’s own official documentation, that documentation is authoritative.