LangChain is a framework for building LLM applications from composable pieces — models, prompts, tools, retrievers, and memory — wired together into…
See LangChain as composable building blocks plus integrations.
LangChain gives you standardized components for the parts of an LLM app: model interfaces, prompt templates, output parsers, tools, retrievers for RAG, and memory. Each has a common interface, so you compose them rather than writing glue for every combination.
Its biggest practical draw is the ecosystem: integrations for dozens of model providers, vector stores, document loaders, and tools, all behind consistent interfaces. That breadth is what lets you assemble a working app quickly and swap components without rewrites.
Distinguish fixed pipelines from model-driven control flow.
A chain is a fixed sequence you define: for example, fill a prompt, call the model, parse the output — the same steps every time, predictable and cheap. LangChain's composition syntax lets you pipe these steps together cleanly.
An agent hands control to the model: given a goal and tools, the model decides which tool to call and when, looping until done. Use a chain when you know the steps in advance; use an agent when the path depends on intermediate results and can't be hard-coded. Agents are more flexible but less predictable and more expensive.
Add capabilities and state to a LangChain app.
Tools are functions you expose so an agent can act — search, a calculator, an API call, a database query. You describe each tool, and the agent's model picks among them. Memory carries context across turns so a conversational app remembers earlier messages.
For knowledge, retrievers connect the app to a vector store so it can pull relevant documents into the prompt — LangChain's building blocks make RAG a few composed components. The ecosystem supplies ready integrations for all of these, so you wire capabilities in rather than building each from scratch.
Know when to graduate to LangGraph and avoid common errors.
LangChain's built-in agents are convenient, but when you need reliable, inspectable control flow — explicit branching, loops with clear stop conditions, persistent state, or human-in-the-loop approval — you move to LangGraph, its companion library that models the agent as an explicit graph. A common pattern uses LangChain components (models, tools, retrievers) inside a LangGraph-defined flow.
So: LangChain to assemble the pieces and simple chains or agents, LangGraph when the control flow itself must be robust and controllable.
Watch for: using an agent when a fixed chain would be cheaper and more reliable; vague tool descriptions so the agent picks wrong; adding heavy abstraction for a task a few direct calls would solve; and letting an agent loop without a step limit. Prefer the simplest composition that works, and move to LangGraph only for genuinely complex flows.
LangChain builds LLM apps from composable components — models, prompts, tools, retrievers, memory — with common interfaces and a broad integration ecosystem. Chains run fixed developer-defined steps; agents let the model choose tools and steps at run time. Tools give agents actions, memory gives context, and retrievers enable RAG. For complex, stateful, inspectable control flow, pair LangChain components with LangGraph. Prefer the simplest composition that works and reach for agents or LangGraph only when the task demands it.
Design a LangChain support app that answers from a docs vector store and can look up order status. Decide which parts are a fixed chain versus an agent with tools, where memory and a retriever fit, and whether the control flow needs LangGraph.
What does LangChain provide?
LangChain standardizes the building blocks of LLM apps and offers broad integrations so you assemble apps rather than writing glue.
What is the difference between a chain and an agent in LangChain?
Chains are predictable fixed pipelines; agents are flexible but less predictable, chosen based on whether the steps are known in advance.
What do retrievers add to a LangChain app?
Retrievers are LangChain's RAG building block, fetching relevant context so the model answers from real data.
When should you move from LangChain's built-in agents to LangGraph?
LangGraph models control flow as an explicit graph, worth it for complex, stateful agents while LangChain assembles the components.