LangChain

Framework for building applications powered by language models.

Agents

Overview

LangChain is the framework the entire AI-agent industry was built around, for better and worse. It launched in late 2022 as a Python library for chaining LLM calls together, arrived at the same moment ChatGPT went viral, and rode that wave to become — briefly — the default way you built anything with an LLM. Three years later it is still the default for a large fraction of engineers, still the most-forked agent framework on GitHub, and still the framework that half the community loves and half the community complains about for good reason.

The honest 2026 picture: LangChain is not one product. It is a family. The Python and JavaScript SDKs are the framework layer. LangGraph is the newer stateful-workflow layer that most serious teams migrated to over the past eighteen months. LangSmith is the paid observability platform that ties everything together and is the actual commercial engine of the company. LangServe deploys chains as APIs. LangGraph Cloud is the newest hosted runtime. When someone says "we use LangChain," the interesting question is which of these they mean.

The distinctive positioning versus Dify and CrewAI is that LangChain is a library, not a platform. There is no visual builder, no hosted runtime by default, no admin console. You install a package, you write Python or TypeScript, you deploy the artifact yourself. In exchange, you get the deepest integration surface in the industry — every major LLM, every vector database, every embedding model, every document loader has a first-class wrapper — and the most sophisticated toolkit for building custom agent behavior.

The framework is Apache-2.0 open source. LangSmith is proprietary and paid past a generous free tier. That combination is important: the runtime is free forever, and the money moves when you want the observability. Most teams eventually pay for LangSmith once an agent is in production, not because they must, but because debugging LLM behavior without traces is genuinely miserable.

Key Features

LCEL (LangChain Expression Language). The composability primitive that made LangChain worth writing again after the early framework's abstractions got ugly. Pipe operator syntax — prompt | model | parser — reads like a diagram, composes Runnable objects, and works across sync, async, streaming, and batch execution with the same code. LCEL is the abstraction the framework should have shipped in 2022 and finally did.

LangGraph. The stateful-workflow sibling. Graph-based execution model — nodes as functions or agents, edges as transitions, state as a first-class object that persists across nodes. Supports checkpointing, human-in-the-loop pauses, cycles, and subgraphs. Genuinely well-designed. Most production LangChain agents in 2026 are LangGraph agents; the older AgentExecutor pattern is legacy code.

Massive Integration Surface. Every LLM (OpenAI, Anthropic, Google, Cohere, Mistral, Together, Groq, Fireworks, Ollama, and dozens more), every vector database (Pinecone, Weaviate, Chroma, Qdrant, pgvector, Milvus, and more), every embedding model, every document loader you'd reach for (PDF, HTML, S3, Notion, Confluence, GitHub, etc.). If it exists in the AI stack, there is a LangChain integration.

Tool Use. Native support for tool-calling agents. Any Python function can be a tool with a @tool decorator; MCP servers are first-class; structured output via Pydantic. Type-safe on the Python side, works across every LLM that supports function calling.

LangSmith. The paid observability platform. Every LLM call gets traced — inputs, outputs, latency, token usage, cost, model — and you get a tree view of the whole agent execution. Datasets, prompt versioning, evaluation runs, human review queues. Not optional in production; the alternative is print statements and hope.

LangServe. Turns any LangChain Runnable into a FastAPI endpoint with one line. Deployment is your problem, but the boilerplate is not.

LangGraph Cloud. The newest hosted runtime — run LangGraph agents as a managed service with checkpointing, scheduling, and a built-in playground. This is LangChain-the-company's answer to the "we don't want to run infrastructure" pushback. Paid.

Streaming Everywhere. Every layer supports streaming — token-level streaming to the user, event-level streaming for observability, structured output streaming for tool use. Table stakes but done well.

Python + JavaScript Feature Parity. The two SDKs stay close in feature set. Matters if your backend is Python and your web tier is Next.js or a Bun server.

Evals and Datasets. LangSmith includes dataset management, LLM-as-judge evaluators, custom evaluators, and regression testing. The mature answer to "how do I tell if my agent got worse after I changed the prompt?"

Pricing

The pricing story is: framework free, observability paid.

LangChain Framework (Free, Apache-2.0) — Python and JavaScript SDKs, LangGraph, LangServe. No fees, no seat limits, no telemetry required.

LangSmith Developer (Free) — Up to 5,000 traces per month, single seat, community-supported. Enough to develop a real agent and evaluate it.

LangSmith Plus (~$39/seat/month) — Higher trace volume, dataset evaluation, custom evaluators, longer retention, priority support. The tier most production teams land on.

LangSmith Enterprise (Custom) — SSO, SAML, self-hosted option (deployed in your VPC), custom SLAs, dedicated support, advanced compliance. Pricing on request; real-world contracts cluster in the mid-four-figure to low-five-figure monthly range.

LangGraph Cloud — Separate pricing based on compute and storage for the hosted runtime. Free tier for evaluation, paid tiers scale with usage.

Feature Framework LangSmith Dev LangSmith Plus Enterprise
Framework use Unlimited Unlimited Unlimited Unlimited
Traces / month N/A 5,000 Higher (project-tiered) Custom
Seats Unlimited 1 Per-seat billed Custom
Datasets & evals N/A Basic Full Full + custom
Self-hosted Yes No No Yes
SSO N/A No No Yes
Starting price $0 $0 ~$39/seat/mo Custom

LLM inference is pass-through — you bring your own API keys, LangChain does not markup model tokens. LangSmith bills on trace volume, which is usually a small line item compared to the LLM spend it helps you debug.

Pros and Cons

Pros.

  • Deepest integration surface in the AI stack. If the tool exists, LangChain wraps it.
  • LCEL is genuinely good composability. Once internalized, it makes complex chains readable.
  • LangGraph is the best stateful-agent runtime in the code-first category. Checkpointing, human-in-the-loop, cycles all work as designed.
  • LangSmith observability is the killer feature. Debugging production LLM agents without it is markedly worse.
  • Python and JavaScript SDKs stay near parity. Real advantage if your stack spans both.
  • Enormous community, most-searched-answer status on Stack Overflow and the LLM subreddits. If you hit a problem, someone has hit it before.
  • Apache-2.0 framework license — no ceiling, no vendor lock at the runtime layer.
  • Mature evaluation tooling via LangSmith datasets and evaluators.

Cons.

  • Abstraction bloat is real and everyone knows it. Simple tasks require three imports where a plain API call would do.
  • Breaking changes across major releases are frequent. Budget for periodic migration work.
  • Documentation is voluminous but often out of sync. Three ways to do most things; the docs sometimes disagree about which is current.
  • Learning curve is steep even for experienced engineers. Not because the concepts are hard but because the framework has many entry points.
  • No visual builder. If you have a PM who wants to compose flows, this is not the tool.
  • Production readiness requires LangSmith, which shifts the "free" claim once you're serious.
  • Some integrations are community-maintained and vary in quality; test carefully before depending on niche wrappers.

Best Use Cases

Engineers building custom production agents. The archetype. You have a real product with real users, you need an agent that plugs into your existing services, and you want the deepest integration surface plus best-in-class observability. LangChain plus LangGraph plus LangSmith is the canonical stack.

Teams that need custom retrieval or agent-state logic. Dify's visual builder hits ceilings on complex custom logic. LangChain has no ceiling because it's a library — you write the code you want.

Multi-modal or multi-provider agents. Because LangChain wraps every model provider identically, switching or mixing is a one-line change. Multi-provider agents that route by task type — cheap model for classification, frontier model for reasoning — are trivial to build.

RAG systems with unusual retrieval requirements. Hybrid search, custom rerankers, structured metadata filtering, multi-vector approaches, contextual retrieval — LangChain has the primitives. Dify's built-in RAG is faster to prototype but less flexible.

Teams that already use LangSmith. If tracing is already part of your workflow, adding new LangChain agents is friction-free. Switching frameworks would mean re-instrumenting the trace layer.

Educational and research settings. The framework's transparency and inspectable behavior make it a better research tool than closed platforms. Papers routinely publish LangChain-based reference implementations.

Bad fit. Non-technical builders who need a visual editor — use Dify. Multi-agent role-play orchestration where "researcher argues with editor" is the actual problem — use CrewAI. Simple one-off scripts where a raw OpenAI SDK call would do — skip the framework tax.

Alternatives

Dify. The visual, hosted, no-code-first alternative. Faster time-to-production, better for product teams and non-engineers, less flexible on custom logic. Full comparison in our agent framework showdown. If you want to see how Dify differs from LangChain in practice, read the Dify tool page.

CrewAI. The multi-agent-by-role specialist. Cleaner than LangGraph if your problem genuinely decomposes into distinct roles with distinct prompts. Less mature integration surface. Head-to-head with LangChain.

AutoGPT Platform. Open-source visual builder with an active community. Less polished than LangChain, but easier for non-engineers to touch. Compare AutoGPT to the alternatives here.

Llama Index. The other well-known Python framework, historically focused on RAG-first workflows. In 2026 the feature overlap with LangChain is significant but Llama Index remains sharper for retrieval-heavy applications with less agent orchestration.

Haystack. The Deepset framework. Production-oriented, opinionated pipelines, strong on document search and RAG. Smaller ecosystem than LangChain but better docs for enterprise-style deployments.

Semantic Kernel. Microsoft's answer, C#/Python/Java. Well-integrated with Azure and enterprise Microsoft stacks. Worth evaluating if you already live in that ecosystem.

Honorable mentions: DSPy for prompt-optimization-first workflows, LlamaIndex Workflows for a lighter-weight orchestration primitive, and Instructor for structured output without the full framework tax.

Getting Started

Getting a LangChain agent to hello-world takes about ten minutes. Getting one to production takes weeks, and that's where the value is.

Step 1: Install. pip install langchain langchain-openai langgraph langsmith (or the JavaScript equivalent). Set your OpenAI or Anthropic API key as an environment variable. Add LANGSMITH_API_KEY if you want tracing from day one — you do.

Step 2: Write LCEL. The obligatory hello-world: prompt | model | parser. Run it. Watch the trace show up in LangSmith. Understand that everything is a Runnable and everything composes.

Step 3: Build a Real Agent. Move to LangGraph. Define a state schema (usually a TypedDict or Pydantic model), define nodes as functions, define edges as transitions. Add a tool node, a human-in-the-loop node, a checkpointer. This is the pattern you'll ship.

Step 4: Instrument. LangSmith tracing is on by default once the env var is set. Watch traces during development, add evaluations before promoting to production, and set up regression tests against a small dataset of representative inputs.

Step 5: Deploy. LangServe if you want the fast path, LangGraph Cloud if you want a managed runtime, or roll your own FastAPI/Next.js layer if you already have deployment infrastructure.

Concrete advice: use LangGraph from the start, not the older AgentExecutor. Use LCEL, not the legacy chain classes. Turn on LangSmith tracing on day one — it will save you multiples of the cost the moment you hit a bug.

FAQ

Is LangChain really open source? The framework — LangChain core, LangGraph, LangServe — is Apache-2.0 on GitHub. LangSmith is proprietary and paid past its free tier. Framework use is free forever; observability is where the money is.

How does LangChain compare to Dify? Dify is a platform with a visual builder; LangChain is a library that expects you to write code. Dify is faster to production and has a ceiling. LangChain is slower to production and has no ceiling. Full breakdown in our Dify vs LangChain vs CrewAI comparison.

Is LangGraph replacing regular LangChain? No — LangGraph is a stateful-workflow layer on top of LangChain. The base LCEL and Runnable primitives are still current. LangGraph is what you reach for when your agent has state, cycles, or human-in-the-loop needs; simpler chains are still fine with pure LCEL.

Do I have to pay for LangSmith? No. The free tier gives 5,000 traces per month, which is enough for development and light production. Most teams eventually upgrade to Plus at ~$39 per seat once they have a production agent and multiple engineers watching it.

Is the abstraction bloat criticism still fair? Partly. LCEL and LangGraph are meaningfully better than the 2022-era chain classes and legacy AgentExecutor. If you started with LangChain in 2023 and left, revisit — the newer primitives are worth another look. If you're new, start with LCEL and LangGraph and ignore the legacy path.

Can I self-host LangSmith? Enterprise tier only. Self-hosted LangSmith runs in your VPC with SSO and audit; pricing is contract-based and lands in the mid-four-figure to low-five-figure monthly range for real workloads.

Which LLM should I use with it? LangChain wraps every major provider identically, so the answer is "whichever fits your use case." Common patterns: Claude for reasoning-heavy tasks, GPT-4o family for tool use and multi-modal, GPT-4o-mini or Claude Haiku for cost-sensitive high-volume steps, Groq or Fireworks for latency-sensitive open-model workloads.

Verdict

LangChain is the correct choice for engineers building custom production agents where flexibility, integration surface, and observability matter more than time-to-first-demo. LCEL plus LangGraph plus LangSmith is the most complete code-first agent stack in 2026, and no other option has the same combination of composability, provider coverage, and mature observability. The tradeoffs — abstraction bloat, breaking changes, steep learning curve, no visual builder — are all real, but for the target audience they are the cost of a framework that scales from a five-line prompt to a thousand-line production agent without hitting a ceiling.

If you want a visual builder and hosted runtime, use Dify. If your problem is genuinely multi-agent role-play, use CrewAI. If you want an open-source visual builder you can self-host, evaluate AutoGPT Platform. Otherwise, LangChain — specifically LangGraph plus LangSmith — is the answer most engineering teams land on eventually.

Start with the framework's free tier and LangSmith Developer. Wire up tracing on day one. Move to LangGraph as soon as your agent has any state or tool use. Upgrade LangSmith to Plus the moment you have a production agent and more than one person debugging it. That progression is boring and reliable, which is exactly what you want from the framework you build a real product on.