Favicon of langchain

langchain

A Python and JS framework for building LLM-powered apps and agents, with a standard interface for models, embeddings, vector stores, and tools.

LangChain is a framework for building agents and LLM-powered applications. It gives developers a standard interface for chat models, embeddings, vector stores, and third-party integrations, so you can chain components together instead of writing bespoke integration code for every model provider or data source. It's aimed at developers building anything from a simple chatbot to more complex agent systems, and it's designed to keep working as the underlying model landscape changes, since swapping providers doesn't mean rewriting your application logic.

Key features

  • Standard model interface: a common API for chat models across providers, so switching from one model to another doesn't require rewriting application code.
  • Large integration library: connectors for chat and embedding models, vector stores, retrievers, and external tools and data sources, documented in the LangChain integrations directory.
  • Modular, composable architecture: work at a high level with prebuilt chains for quick starts, or drop down to low-level components for fine-grained control.
  • init_chat_model helper: a single function to instantiate a chat model from any supported provider with minimal setup code.
  • Ecosystem integration: works standalone or alongside companion products, including Deep Agents for planning and subagent patterns, LangGraph for lower-level agent orchestration, and LangSmith for evaluation, observability, and debugging.
  • JS/TS parity: an equivalent JavaScript/TypeScript library, LangChain.js, mirrors the Python framework for teams working in a Node environment.
  • Structured learning resources: a public API reference, a community discussion forum, and free courses through LangChain Academy for learning the libraries and products.

Ideal use cases

LangChain fits developers building LLM-powered applications that need to pull in outside data or systems, such as retrieval-augmented chatbots, document question answering, or tools that call multiple APIs based on model output. It's also useful during early prototyping, since its component-based design lets you swap models, vector stores, or retrieval strategies without restructuring the whole application. Teams that expect to change model providers over time benefit from the standard interface, since the abstraction absorbs most of that churn, and teams that outgrow simple chains can move to Deep Agents or LangGraph without leaving the ecosystem.

If you need low-level, highly controllable orchestration for complex agent workflows, especially ones with intricate state or branching logic, the project itself points you toward LangGraph rather than the base LangChain framework. LangChain's abstractions also mean you're trading some directness for portability. If your application only ever needs a single model provider and a simple prompt-response loop, calling that provider's SDK directly may be simpler than adopting a framework at all.

LangChain also fits organizations that expect to keep iterating on their approach over time, since its component-based architecture is built specifically so that swapping a model, a vector store, or a retrieval strategy doesn't force a rewrite of the surrounding application logic. Teams that want a shared vocabulary and pattern library across multiple LLM projects, rather than each project inventing its own integration code, benefit from standardizing on a common framework like this one, and new team members can ramp up faster against documented, reusable patterns instead of reverse-engineering a bespoke integration layer.

Installation

Install with uv (or pip):

uv add langchain

A minimal example of initializing and calling a chat model:

from langchain.chat_models import init_chat_model

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

For more advanced agent orchestration, the project points to LangGraph as a companion framework, and Deep Agents as a higher-level package built on LangChain for agents with built-in planning, subagents, and file system usage. For a JavaScript or TypeScript project, LangChain.js provides the equivalent library. LangSmith, a separate product, adds evaluation, observability, and debugging for applications built with LangChain, and LangSmith Deployment handles deploying and scaling long-running, stateful agents.

Frequently asked questions

Share:

Stars
141.4K
Forks
23.5K
Last commit
2 hours ago
Repository age
4 years
License
MIT
Self-hosted
No
Activity score
92/100
View Repository
Built with:

Similar to langchain

Favicon

 

  
  
Favicon

 

  
  
Favicon