A framework for building agents and LLM-powered applications
open sourceMITself-hostablefree
LangChain is an MIT-licensed framework, in Python and JavaScript/TypeScript (LangChain.js), for building agents and LLM-powered applications. Its create_agent harness runs a model with tools in a loop and adds guardrails, retries, model routing and tool policies through middleware, and one standard interface for chat models and embeddings lets you switch between OpenAI, Anthropic, Google, Ollama, Bedrock and other providers with few code changes. It has more than 1,000 integrations (models, tools, document loaders, vector stores, checkpointers and sandboxes) and connects agents to MCP servers through its MCPAdapter. Since version 1 its agents run on LangGraph, which gives them durable execution, persistence and human-in-the-loop; LangChain Inc's commercial LangSmith traces, evaluates and hosts them, and its Deep Agents package is a higher-level harness built on it.
Problems it solves
- swap between OpenAI, Anthropic and a local Ollama model in my Python app without rewriting the code that calls it
- build an AI agent that calls my own Python functions as tools in a loop until the task is done
- add guardrails, retries and a fallback model around my agent's LLM calls without writing that plumbing myself
- load documents from many sources and store their embeddings in whichever vector database we already run
- a JavaScript or TypeScript library for building LLM agents that works the same way as the Python one my data team uses
- give my agent the tools from an MCP server so it can use them alongside my own functions
- ready-made integrations for chat models, embeddings and vector stores so my LLM app isn't tied to one vendor
- build a chatbot over our internal documents that retrieves the relevant passages before it answers
- make my agent stop and wait for a person to approve a risky tool call before it runs
- keep an agent's state so a run can pick up where it left off after the process crashes
- send easy questions to a cheap model and hard ones to a stronger model inside my agent
- enforce rules about which tools my LLM agent may call, and with what arguments
- use OpenRouter, AWS Bedrock or Azure OpenAI models through the same interface as the providers' own APIs
- let my agent run code in a sandbox through an off-the-shelf integration instead of building one
- start an LLM app in a few lines of Python and move to lower-level control later without switching libraries
Features
- create_agent: a minimal, configurable agent harness (prompt, tools, model loop)
- middleware for guardrails, retries, routing and custom tool policies
- one interface for chat models and embeddings across providers (init_chat_model with provider:model strings)
- provider packages such as langchain-openai, langchain-anthropic, langchain-ollama, langchain-aws and @langchain/anthropic
- more than 1,000 integrations: chat and embedding models, tools and toolkits, document loaders, vector stores, checkpointers, sandboxes
- MCPAdapter connects agents to MCP servers over Streamable HTTP, stdio or in-process FastMCP servers
- agents run on LangGraph for durable execution, persistence and human-in-the-loop
- Python (langchain) and JavaScript/TypeScript (langchain on npm) libraries
- tracing and evaluation in LangSmith by setting LANGSMITH_TRACING
- Deep Agents: a higher-level harness built on LangChain with planning, a virtual filesystem and subagents
Capabilities
| Takes plugins | plan not known |
|---|
Alternatives
The same job
These do what LangChain does.
- PraisonAI Open source AI agent framework that can run fully offline on your own computers
- Mastra The modern TypeScript framework for AI-powered applications and agents
- Pydantic AI How Python does AI: agents, realtime voice, image generation, embeddings, typed end to end
- Semantic Kernel Model-agnostic SDK for building AI agents and multi-agent systems in C#, Python and Java
- LlamaIndex A Python toolkit for building LLM-powered agents over your data
- Haystack Open-source AI orchestration framework for building production-ready LLM applications in Python
