How the LangChain stack fits together
Five pages covering the pieces you actually touch in the LangChain 1.x stack: one per package for building an agent, and two for retrieval. Every entry says what the class or function defines or does, links to the official API page (opens in a new tab), and ends with a runnable example whose printed output was verified against the pinned versions.
| Page | Package | Pinned version | What the package contributes |
|---|---|---|---|
| langchain-core reference | langchain-core | 1.6.2 | The types: message classes, BaseChatModel, BaseTool/@tool, Runnable, prompts, output parsers. No provider client, no loop, no runtime. |
| langgraph reference | langgraph | 1.2.11 | The runtime: StateGraph → CompiledStateGraph, state with reducers, Command, interrupt, checkpointers, Send. Knows nothing about models. |
| langchain reference | langchain | 1.4.0 | The prebuilt agent: create_agent, AgentState, middleware, structured output, init_chat_model. Assembles a langgraph graph out of langchain-core types. |
| langchain-core retrieval reference | langchain-core | 1.6.2 | The retrieval types in the same package: Document, BaseLoader, Embeddings, VectorStore/InMemoryVectorStore, BaseRetriever. A retriever is a Runnable. Needs numpy for the in-memory store. |
| langchain-text-splitters reference | langchain-text-splitters | 1.1.2 | The chunkers: TextSplitter, CharacterTextSplitter, RecursiveCharacterTextSplitter, MarkdownHeaderTextSplitter, RecursiveJsonSplitter. Depends on langchain-core only. |
How the three parts relate
1 you write you run
2 │ │
3 langchain │ create_agent(model, tools, middleware=…, response_format=…)
4 (agent layer) │ │ builds a StateGraph and calls .compile()
5 ▼ ▼
6 langgraph │ CompiledStateGraph.invoke / stream / get_state
7 (runtime) │ │ runs nodes, merges state, checkpoints, pauses on interrupt()
8 ▼ ▼
9 langchain-core│ BaseChatModel.invoke(list[BaseMessage]) -> AIMessage
10 (types) │ BaseTool.invoke(tool_call) -> ToolMessage
11 │ HumanMessage / AIMessage / ToolMessage / SystemMessage
12 ▼
13 provider pkg │ langchain-anthropic, langchain-openai, … subclass BaseChatModel
The dependency arrow points down and only down. Verified from the installed packages' metadata and by import tracing:
langchain1.4.0 requireslanggraph<1.3.0,>=1.2.11andlangchain-core<2.0.0,>=1.6.0.langgraph1.2.11 requireslangchain-core<2,>=1.4.7. It does not requirelangchain, and importing it does not importlangchain.langchain-core1.6.2 requires neither. Importing every one of its modules leaveslanggraphandlangchainabsent fromsys.modules.langchain-text-splitters1.1.2 requires onlylangchain-core>=1.2.31, and importing it leaveslanggraphandlangchainabsent too. It sits beside the stack, not in it.
What that means in practice:
- An agent is a graph.
create_agent(langchain) returns aCompiledStateGraph(langgraph). Everything the langgraph file says aboutinvoke,stream,get_state, checkpointers andinterruptapplies to an agent unchanged, andagent.get_graph().draw_mermaid()shows you themodel ⇄ toolsloop it built. - The graph's state is a list of langchain-core messages.
AgentState.messages(langchain) isMessagesState.messages(langgraph) islist[AnyMessage]merged byadd_messages, and the items areHumanMessage/AIMessage/ToolMessage(langchain-core). - Models and tools are langchain-core objects.
create_agentcallsBaseChatModel.bind_toolsand runsBaseTool.invoke(tool_call); the provider package supplies the concrete model class. - Middleware is the seam between the layers.
AgentMiddlewarehooks (langchain) receive the langgraph state and aModelRequestholding langchain-core messages and tools. - Retrieval is langchain-core plus one sibling package.
Document,Embeddings,VectorStoreandBaseRetrieverare core types — a retriever is aRunnable, so it drops into a|chain or a graph node like any other — and chunking islangchain-text-splitters, which depends on core alone. Neither toucheslanggraphorlangchain.
Which page to open
| You are holding / deciding… | Open |
|---|---|
a message, a tool, a model object, a prompt template, | pipelines | langchain-core reference |
| what runs next, how state is merged, pausing/resuming, parallel fan-out, persistence | langgraph reference |
"give me an agent without drawing the graph", approval before tools, context trimming, structured answers, "provider:model" strings | langchain reference |
a Document, an embedding model, a vector store, a retriever, the shape of a RAG chain | langchain-core retrieval reference |
cutting text, Markdown, code or JSON into chunks before embedding it; chunk_size/chunk_overlap | langchain-text-splitters reference |
Each page has the same shape: pinned version → what the package is → an Index table (name, what it defines/does, most-used members) → one section per name with the official link, a concrete description, a verified example, and for graphs the Mermaid diagram the code itself printed.
Reproducing the examples
1python3 -m venv .venv && source .venv/bin/activate
2pip install "langchain==1.4.0" "langchain-core==1.6.2" "langgraph==1.2.11" "langchain-anthropic==1.7.1" \
3 "langgraph-checkpoint-sqlite==3.1.1" "langchain-text-splitters==1.1.2" "numpy==2.5.2"
langchain-text-splitters 1.1.2 is the version pip resolves beside core 1.6.2 with no pin. numpy
is declared by none of these packages, but InMemoryVectorStore and the fake embeddings import it
lazily and fail without it; 2.5.2 is what resolved.
All examples run offline (they use langchain_core's GenericFakeChatModel or a five-line
BaseChatModel subclass) except one, marked The one live example in the langchain reference, which
needs ANTHROPIC_API_KEY and skips itself without it. Verified on Python 3.13.7 — the three
stack pages on 2026-09-05, the two retrieval pages on 2026-09-06.
Old-tutorial warnings, collected
langgraph.prebuilt.create_react_agent→ deprecated since LangGraph 1.0 (warning classLangGraphDeprecatedSinceV10, removal planned for 2.0). Uselangchain.agents.create_agent.AgentExecutor,initialize_agent,LLMChain,ConversationChainand the otherChainclasses → moved to the separatelangchain-classicpackage (1.0.8); importing them fromlangchain.agentsraisesImportError. A tutorial using them predates 1.0.langchain-mcp-adapters→ its tool conversion was ported intolangchain.mcp(MCPAdapter) in langchain 1.4.0; needs thelangchain[mcp]extra.langchain.text_splitter,langchain.vectorstores,langchain.document_loaders,langchain.schema→ModuleNotFoundErrorin langchain 1.4.0. The splitters arelangchain_text_splitters;Document,Embeddings,VectorStoreandBaseRetrieverarelangchain_core.*; concrete loaders and stores are their own packages (langchain-community,langchain-chroma, …).
What changed since the previous edition of these notes
The previous edition pinned langchain==1.3.14, langchain-core==1.5.3, langgraph==1.2.10.
All 28 of its examples produce identical output on the versions pinned here. Notable additions in
between, none of which change the APIs documented in the three pages:
- langchain 1.3.14 → 1.4.0: the
langchain.mcpnamespace (MCPAdapter,as_langchain_tool);ContextEditingMiddlewareaccepts a customtoken_counter; standard model exception types. - langchain-core 1.5.3 → 1.6.2: standard model exception types;
StructuredToolis JSON-serializable; assorted fixes to tool-schema generation and content-block handling. - langgraph 1.2.10 → 1.2.11:
trace_policyonadd_node;langgraph-checkpoint4.2.0.