LangChain
LangChain is an open-source framework for building apps and agents on top of large language models, with one standard way to talk to many AI providers.
LangChain is an open-source framework for building apps and agents that run on large language models (LLMs). A framework is a set of ready-made building blocks you plug your own code into. LangChain is released under the MIT license. There is also a version for JavaScript and TypeScript, called LangChain.js.
Imagine you want an app that answers questions using an AI model. A provider is a company that hosts AI models and offers them through an API, such as OpenAI, Anthropic or Google. LangChain puts one standard interface in front of many providers. An interface is the set of commands your code uses. Because it stays the same, switching models needs only small code changes. Many providers have their own LangChain package, such as langchain-openai or langchain-anthropic. The docs list more than 1,000 integrations. These are ready-made connections to chat and embedding models, tools, document loaders and vector stores.
The second thing LangChain adds is an agent loop. LangChain describes an agent as a model that keeps using tools, round after round, until the job is finished. A tool is a function with clear inputs and outputs that the model is allowed to ask for. Tools let an agent fetch live data, run code, query databases and take actions. The model decides when to call a tool and which inputs to give it.
LangChain calls everything around those rounds the harness. That means the prompt, the list of tools and any middleware you add. Its main building block here is a function called create_agent. You build an agent from a model, a list of tools, a prompt and optional middleware. Middleware is optional extra code that shapes how the agent behaves. It can add guardrails (safety checks), retries and routing. When you turn a normal function into a tool, its docstring, the short note at the top of the function that explains it, becomes the tool’s description. Type hints, the labels that say what kind of value each input is, define what the tool accepts.
LangChain’s starter example builds an agent with one weather tool. The tool is a stand-in that always says it is sunny. You ask what the weather is in San Francisco. The model sees a weather tool and calls it with the city name. The harness runs the function and passes its output along. The model reads it and writes the final answer.
LangChain sits in a wider set of related projects. Underneath, LangChain agents run on LangGraph. LangGraph is a lower-level runtime: the engine that keeps long-running agents and workflows going. Through it, agents can save their progress, pause for a human to check a step, and survive failures by resuming where they left off. You do not need LangChain to use LangGraph. Deep Agents sits one layer above LangChain and adds planning, subagents and file system use. LangSmith is a separate platform for tracing (recording each step), evaluation and deployment. There you can inspect traces and tool calls.
A framework does not make the model any smarter. The docs say the model you choose directly shapes how reliable the agent is, because the model decides which tools to call and when to answer. The model also reads your tool descriptions to work out when to use each tool, so clear docstrings matter. Some workflows mix fixed, hand-written steps with steps the model decides. For those, the docs point to LangGraph rather than a plain LangChain agent.
Calling a model's API directly leaves a lot of plumbing for you to write.
Follow one weather question through a LangChain agent.
- 1 · pickYou choose a model by passing an identifier string in the form provider:model.
- 2 · wrapYou turn an ordinary function into a tool, and its docstring becomes the tool's description.
- 3 · decideThe model reads the conversation and decides whether to call a tool and which inputs to give it.
- 4 · runThe harness runs the chosen tool, then hands its output to the model.
- 5 · finishThe loop repeats until the task is complete, then the model gives its final answer.
LangChain runs the loop, but the model still makes every decision.
| Who | What they ask | What it works with |
|---|---|---|
| Startup developer | “Can we test our chatbot on a different model without rewriting it?” | The standard chat model interface and provider packages |
| Support team engineer | “Can our assistant look up an order before it replies?” | A custom tool that queries the order database |
| Student building a project | “How do I make a small agent that checks the weather?” | create_agent with one weather tool |
| Platform team | “Where did our agent go wrong on this request?” | Traces and tool calls in LangSmith |
- It gives one interface for chat models and embeddings across many providers.
- It offers ready-made integrations with models, tools, document loaders and vector stores.
- It provides create_agent, a configurable harness that runs the model and tool loop.
- Middleware lets you add extras such as guardrails, retries and routing.
- It does not make a weak model reliable, because the chosen model directly shapes how well the agent performs.
- It does not write your tool descriptions for you, and the model reads them to decide when to use each tool.
- For workflows that mix fixed steps with model-driven steps, the docs point to LangGraph instead.
Sources used
This explainer is written in original language. The links below support its factual claims.
- docsLangChain overview, LangChain · read 28 Sept 2026
- docsAgents, LangChain · read 28 Sept 2026
- docsModels, LangChain · read 28 Sept 2026
- docsTools, LangChain · read 28 Sept 2026
- docsLangChain Python integrations, LangChain · read 28 Sept 2026
- repolangchain-ai/langchain, LangChain on GitHub · read 28 Sept 2026
- docsLangGraph overview, LangChain · read 28 Sept 2026