Model or dataset
langchain-ai/langchain avatar
langchain-ai/langchain

LangChain: A Common Layer for Models, Tools and Agents

LangChain gives agent builders a common layer for models, tools, retrieval, and multi-step execution.

147,049 stars24,608 forksPythonMIT

At a glance

What is it?
LangChain is an MIT-licensed Python framework that gives agent builders one interface for chat models, tools, retrieval and multi-step execution. It is a good fit when you expect to swap providers; it is a poor fit if you want a small dependency tree.
Who is it for?
Adopt LangChain when you are building an agent or LLM application that must outlive one model provider, and you accept the abstraction layer that makes provider swaps cheap. Do not adopt it if your application is a single prompt against a single provider, or if you have decided that every dependency in the request path must be yours.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 4 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 25, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The problem LangChain solves for agent builders

The README frames the project as a framework that helps you chain together interoperable components and third-party integrations. That sentence is the whole pitch, and it is worth unpacking because it describes a coordination problem rather than a capability. If you write an application against one provider's SDK, every model call, embedding call and vector store query carries that provider's types. Changing providers later means editing call sites, not configuration. LangChain's answer is a standard interface for models, embeddings and vector stores, so the call site stays fixed while the provider behind it moves.

The audience follows from that. The README lists model interoperability and rapid prototyping as the reasons to use it, and both are concerns of teams that are still deciding what to build on. A team that has already decided, and has one provider and one retrieval store, gets less from the layer. The README also points beginners at Deep Agents, a higher-level package built on LangChain for agents with planning, subagents and file system usage. So the framework itself is aimed at people who want to assemble their own agent loop rather than accept a packaged one.

How LangChain actually works: models, tools and execution

The mechanism visible in the README is a factory plus an interface. init_chat_model takes a provider-qualified string such as "openai:gpt-5.5" and returns a chat model object. That object exposes invoke, which takes a string and returns a result. Everything else in the framework is built on that shape: components that accept a common input and produce a common output, so they can be composed without the caller knowing which vendor is behind them.

The README describes the surrounding pieces as a library of integrations with model providers, tools, vector stores and retrievers. Tools are the part that matters for agents, since an agent loop is a model that decides which tool to call, receives the result, and decides again. LangChain supplies the tool abstraction and the integrations; LangGraph, described in the README as a low-level agent orchestration framework, supplies the controllable workflow layer for tasks that need durable, stateful execution. The split is deliberate: LangChain is the component layer, LangGraph is the execution layer, and Deep Agents is a prebuilt pattern on top.

One consequence of this design is that the abstraction is the product. The README's promise that abstractions keep you moving as the frontier evolves is only as good as the coverage of the integration you need. Where an integration exists, swapping providers is a string change. Where it does not, you are writing against the vendor SDK anyway, and the layer adds indirection without removing work.

How to install LangChain and run a first call

The README gives a single install command. It uses uv, the package manager the project documents, and adds langchain to the current environment. If you use pip instead, the PyPI package name is the same, langchain, but the README itself shows the uv form.

bash
uv add langchain

With the package installed, the quickstart imports init_chat_model from langchain.chat_models, constructs a model from a provider-qualified string, and invokes it with a plain string. The README uses "openai:gpt-5.5" as the example. Note that the call is synchronous: invoke returns the result directly, and the result is printed.

python
from langchain.chat_models import init_chat_model

model = init_chat_model("openai:gpt-5.5")
result = model.invoke("Hello, world!")

What you should see is a model response object rather than a raw HTTP payload, because the point of the interface is that the return type does not change when the provider does. The README does not document the credential setup for the OpenAI provider in the quickstart, so you will need to check the provider's own integration page under the Integrations documentation for the environment variable it expects. The README also points to LangChain.js for the equivalent JavaScript and TypeScript library, and to LangGraph once you need orchestration beyond a single call.

Where LangChain is the wrong tool

The honest limitation is dependency surface. LangChain's value comes from a large library of integrations, and that library is the reason the package is not small. If your application calls one model with one prompt and no tools, the framework is a layer between you and the provider SDK that returns the same answer with more moving parts. The README's own advice points beginners at Deep Agents rather than the framework, which is a signal that raw LangChain is not the shortest path for simple cases.

A second limitation is version churn. The recent releases show langchain==1.3.18 alongside langchain==1.4.0a1 and langchain==1.4.0a2, so the project ships stable and alpha lines in parallel. Pinning matters more than usual here, because an alpha in your lockfile is a different risk from a stable release. The README does not document a rollback procedure, and it does not describe a deprecation policy for the abstractions themselves, so the cost of a breaking change is something you discover from the changelog rather than from the front page.

A third case is control over the execution loop. If you need to inspect and modify every step of a multi-step agent run, the README directs you to LangGraph, described as a low-level orchestration framework. Using LangChain alone for that job means building the loop yourself on top of components that were not designed to own it.

LangChain versus LangGraph and Deep Agents

The README positions three layers, and the difference between them is the level at which you give up control. LangChain is the component layer: models, embeddings, vector stores, retrievers and tools behind common interfaces. LangGraph is the execution layer: a low-level framework for controllable agent workflows, aimed at tasks that are complex enough to need explicit orchestration. Deep Agents is the packaged layer: a higher-level package built on LangChain with built-in capabilities for planning, subagents and file system usage.

The practical difference is what you write. With Deep Agents you adopt a pattern and configure it. With LangGraph you define the workflow and its state transitions. With LangChain alone you compose components and own the loop. Choosing the wrong layer shows up as either fighting a pattern you did not want or rebuilding orchestration that already exists. The README's advice is explicit: use Deep Agents if you are just getting started, and reach for LangGraph when you need advanced customization or agent orchestration.

Maintenance, licensing and upgrade cost

The repository is not archived, and the last push was on 2026-08-28, which is recent enough that the project is being worked on rather than parked. The release cadence visible in the recent releases is fast: three releases within two days, spanning 1.3.18 and two 1.4.0 alphas. Fast cadence cuts both ways. You get fixes quickly, and you also get a stream of versions to evaluate.

The licence is MIT, which permits commercial and closed-source use and imposes few obligations beyond preserving the licence notice. That is a permissive licence, not a copyleft one, so it does not force you to publish your application source. This is a description of the licence text, not legal advice; if your organisation has rules about third-party dependencies, run the MIT terms past whoever owns that process.

Upgrade cost is dominated by the abstraction layer. Because your call sites are written against LangChain interfaces rather than provider SDKs, a provider change is cheap and a LangChain interface change is not: it touches every call site at once. Budget for reading release notes before bumping, and prefer the stable line over the 1.4.0 alphas unless you are deliberately tracking pre-release behaviour.

Editorial conclusion

Adopt LangChain when you are building an agent or LLM application that must outlive one model provider, and you accept the abstraction layer that makes provider swaps cheap. Do not adopt it if your application is a single prompt against a single provider, or if you have decided that every dependency in the request path must be yours. Before committing, verify three things: that init_chat_model accepts the provider string you intend to use, that the integration you need is listed under the Integrations documentation, and that the release you pin is not one of the 1.4.0 alpha builds, which the repository tags as langchain==1.4.0a1 and 1.4.0a2.

Frequently asked questions

What is LangChain versus OpenAI?

LangChain is a framework for building agents and LLM-powered applications, while OpenAI is a model provider. The README shows LangChain initialising an OpenAI model through init_chat_model("openai:gpt-5.5"), which is the relationship: LangChain is the layer, the provider is behind it.

Is LangChain a RAG framework?

The README describes real-time data augmentation, connecting LLMs to diverse data sources through integrations with model providers, tools, vector stores and retrievers. Those are the components a retrieval-augmented generation pipeline is built from, but the README presents them as one use of the framework rather than its definition.

Is LangChain a Python library?

The primary language of this repository is Python, and the README gives a Python quickstart that imports init_chat_model from langchain.chat_models. The README also points to LangChain.js for an equivalent JavaScript and TypeScript library.

How does LangChain actually work?

It provides a standard interface for models, embeddings, vector stores and retrievers, so components can be composed without the caller knowing which provider is behind them. init_chat_model builds a chat model from a provider-qualified string, and that model exposes invoke as the entry point.

How to install LangChain in Python?

The README gives one command, uv add langchain, which adds the langchain package to the current environment. The PyPI package name is langchain, and the README points to the documentation for conceptual guides and the API reference for public classes and functions.

How to use LangChain and LangGraph together?

LangChain supplies the components, and LangGraph, described in the README as a low-level agent orchestration framework, supplies the workflow layer. The README directs you to LangGraph when you need advanced customization or agent orchestration beyond what the framework alone provides.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
For maintainers

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/langchain-ai-langchain.svg)](https://hysenlabs.com/projects/langchain-ai-langchain)
Community notes

Community notes