LangChain: Introduction

LangChain is the most widely used framework for building LLM applications. It gives you standardised building blocks — models, prompts, chains, tools, memory, retrievers, and agents — plus 600+ integrations, so you can go from idea to a working RAG app or agent in hours instead of weeks. If you're building anything on top of LLMs, LangChain is likely the fastest path from zero to running.

💡 In one line: LangChain is an open-source framework of reusable building blocks and integrations for building LLM apps, agents, and RAG pipelines.

What is LangChain?

LangChain is an open-source (MIT) framework — Python and JavaScript/TypeScript — for building applications powered by LLMs. Created by Harrison Chase in late 2022, it's become the de facto standard, providing modular components and a huge library of integrations (models, vector stores, tools, document loaders).

The LangChain Ecosystem

The modern stack is three connected pieces:

  • LangChain — build (components, integrations, and LCEL chains).
  • LangGraph — orchestrate (a stateful, cyclic runtime for complex agents).
  • LangSmith — observe (tracing, evaluation, and debugging).

Core Building Blocks

These map directly to the rest of this topic:

  • Models — a standard interface to 100s of LLMs and embedding models.
  • Prompts — reusable prompt templates.
  • Chains (LCEL) — compose steps with the pipe operator.
  • Tools — capabilities agents can call.
  • Memory — conversation and task state.
  • Retrievers — the RAG retrieval layer.
  • Agents — an LLM that decides which actions to take.

LCEL: Composing Chains

LCEL (LangChain Expression Language) composes components with a pipe operator into a linear pipeline.

Whiteboard
Whiteboard diagram

In code that's simply retriever | prompt | model | output_parser.

LangChain vs. LangGraph

  • LangChain (LCEL) — linear, stateless pipelines: RAG, simple Q&A, single-step tool use.
  • LangGraph — stateful, cyclic graphs for complex agents: loops, branching, persistence, human-in-the-loop.

They're complementary, not competing — since late 2025, LangChain's create_agent actually runs on LangGraph internally. Rule of thumb: a straight line → LCEL; a decision flowchart with cycles → LangGraph.

Why Use LangChain?

  • 600+ integrations — models, vector stores, tools, loaders.
  • Modular — swap OpenAI for Claude in one line.
  • Ecosystem — observability and evaluation via LangSmith.
  • Fast prototyping — a RAG pipeline in under 50 lines.

Code Example (LCEL)


Trade-offs

  • API churn — breaking changes between versions (pin your dependencies).
  • Abstraction overhead — some teams find the layers excessive.
  • For RAG-only apps, LlamaIndex is more focused; for simple agents, the Claude or OpenAI Agents SDK may be enough.

Alternatives

LlamaIndex, CrewAI, AutoGen, DSPy, Haystack, and the Claude / OpenAI Agents SDKs.

What's Ahead

The next subtopics cover LangChain's Tools, Memory, Retrievers, and Agents.

A Note on Currency

In 2026, LangChain is on its v1.x line, LangGraph has reached GA and is now the engine behind LangChain agents (create_agent), and LangSmith provides observability. Given the framework's fast pace, check docs.langchain.com for current APIs.

Summary

  • LangChain is the de facto open-source framework for LLM apps.
  • The ecosystem is LangChain (build), LangGraph (orchestrate), and LangSmith (observe).
  • Core blocks: models, prompts, chains, tools, memory, retrievers, agents.
  • LCEL composes linear chains; LangGraph handles stateful, cyclic agents.
  • Its strength is breadth and ecosystem; watch API churn and abstraction overhead. EOF echo created