LangChain has been the most-used LLM framework since 2023. By 2026 it's matured into an ecosystem of four parts:
Part 1 — LangChain (core library)
The Python (and JavaScript) library for building LLM apps. Provides:
- LLM wrappers — same interface for Anthropic, OpenAI, Google, etc. Switch providers with one line.
- Prompt templates — parameterized prompts.
- Output parsers — structured output (JSON, lists, etc.).
- Document loaders — PDFs, web pages, databases.
- Text splitters — chunking for RAG.
- Vector stores — wrappers over Pinecone, Qdrant, pgvector, etc.
- Retrievers — RAG retrieval abstractions.
- Memory — conversation history management.
- LCEL — composition language (more below).
Part 2 — LCEL (LangChain Expression Language)
A pipe-based composition language for chains. This is THE way to write LangChain code in 2026.
from langchain_core.prompts import ChatPromptTemplate
from langchain_anthropic import ChatAnthropic
from langchain_core.output_parsers import StrOutputParser
prompt = ChatPromptTemplate.from_template("Translate '{text}' to {language}")
llm = ChatAnthropic(model="claude-sonnet-4-6")
parser = StrOutputParser()
chain = prompt | llm | parser
result = chain.invoke({"text": "Hello world", "language": "Hindi"})
The | operator chains components. Each component's output becomes the next's input.
Why LCEL matters:
- Streaming for free (
.stream()instead of.invoke()). - Batching for free (
.batch()). - Async for free (
.ainvoke()). - Observability via LangSmith (auto-traced).
- Composable with other LCEL pieces.
The pre-LCEL API (LLMChain, SimpleSequentialChain, etc.) is deprecated. Don't use it.
Part 3 — LangChain Hub
A repository of community-contributed prompt templates.
from langchain import hub
prompt = hub.pull("hwchase17/react-json")
# Pre-built ReAct prompt; ready to use
Use cases:
- Battle-tested prompts for common patterns (ReAct, Self-Ask, Structured Chat).
- Sharing your own prompts across projects.
- Versioning prompts separately from code.
Not essential, but useful for starting points and standard patterns.
Part 4 — LangSmith
The observability and evaluation platform. Paid product (free tier exists).
Provides:
- Tracing — every LLM call, tool invocation, chain execution logged with inputs/outputs/timing.
- Eval — run datasets through chains, score outputs, compare versions.
- Monitoring — production metrics, alerts.
- Prompt playground — test prompts in UI.
- Datasets — manage eval data.
import os
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_API_KEY"] = "your-key"
os.environ["LANGCHAIN_PROJECT"] = "my-project"
# Now every chain call is traced automatically
For production LangChain apps, LangSmith is near-mandatory. Without it, debugging multi-step chains is painful.
Part 5 (sort of) — LangGraph
Technically separate library but same team and ecosystem. State-machine framework for stateful agents. Module 2 covers it in depth.
What's deprecated (don't use in new code)
LLMChain,SimpleSequentialChain,SequentialChain— use LCEL.AgentExecutorand the old "agents" interface — use LangGraph.ConversationBufferMemoryand direct memory classes — use LangGraph's checkpointing.- The pre-RAG retrievers — use modern LCEL retrievers.
If a tutorial uses these, it's from 2023-2024. Skip it; find a 2025+ tutorial.
What's stable (safe to learn)
- LCEL (the foundation; stable since 2024).
- ChatModels API (chat-style messaging, replaces older LLM API).
- Output parsers with Pydantic.
- Document loaders.
- Retrievers (modern interfaces).
- Tool calling (via @tool decorator and bind_tools).
- LangGraph (separate library, stable API).
Installing LangChain in 2026
# Core
pip install langchain langchain-core
# Provider integrations (pick what you need)
pip install langchain-anthropic langchain-openai langchain-google-genai
# Common extensions
pip install langchain-community # community-contributed integrations
pip install langgraph # state-machine agents
pip install langsmith # observability (auto-loaded if env vars set)
# Vector stores (pick one)
pip install langchain-pinecone # or langchain-qdrant, langchain-chroma, etc.
Don't install langchain alone and expect everything to work. The library was split into smaller packages in late 2024 for modularity.
Migration from old LangChain
If you have 2023-style LangChain code:
# OLD (deprecated)
from langchain.chains import LLMChain
chain = LLMChain(prompt=prompt, llm=llm)
chain.run("input")
# NEW (LCEL)
chain = prompt | llm | StrOutputParser()
chain.invoke({"text": "input"})
Most old patterns have direct LCEL equivalents. The migration guide on langchain.com walks through them.
When NOT to use LangChain
LangChain is the most popular framework but not always the right choice:
- Single LLM call with no composition — overkill. Use the provider's SDK directly.
- You need very specific control — LangChain's abstractions might fight you. Direct API is fine.
- Performance-critical — LangChain adds overhead (~5-50ms per chain call). Direct API is faster.
For complex multi-step apps with state, tools, retrieval, and observability — LangChain + LangGraph + LangSmith is hard to beat.
Common LangChain mistakes in 2026
- Following 2023 tutorials. Heavy reliance on deprecated APIs.
- Not using LCEL. Pre-LCEL code is much more verbose and harder to maintain.
- Skipping LangSmith. Production debugging without traces is brutal.
- Treating LangChain as monolithic. It's a package family; install only what you need.
- Using AgentExecutor for new code. Use LangGraph instead.
Takeaway
LangChain ecosystem in 2026: core library + LCEL composition + Hub for prompts + Smith for observability + LangGraph for agents. Skip 2023 tutorials. Use LCEL for chains; LangGraph for agents; LangSmith for any non-trivial app.