langchain
by langchain-ai
Framework for building LLM-powered applications and agents.
- Stars
- 150,021 stars
- Forks
- 25k forks
- Last push
- today
- Activity
- Active
# Add LangChain to your project$ uv add langchainCommands from the project's README. Run them after installing (see below).
Overview
Understand langchain in 60 seconds
- What it does
- LangChain is a Python framework for building AI agents and apps powered by large language models. It gives you a standard interface for models, embeddings, vector stores and tools, plus a large library of integrations, so you can connect models to your data and swap providers easily.
- The problem it solves
- Every model provider and data source has its own API, and wiring them into an app gets messy fast. LangChain provides interoperable components and integrations so you can build and change AI apps without rewriting them.
- Why choose it
- Choose it for the largest integration ecosystem and a standard model interface. For lower-level, controllable agent workflows, its sister project LangGraph is the recommended tool; Deep Agents is a higher-level option.
- Who should use it
- Python developers building LLM apps and agents
- Teams connecting models to their own data
- Developers who want to switch model providers easily
- Learners exploring agent development
- Setup difficulty
You'll need:
- Python
- An account and API key for the model provider you use
How langchain works
LangChain helps you chain together interoperable components and third-party integrations. Its standard interface covers chat models, embeddings, vector stores, retrievers and tools, so you can swap models in and out as you experiment.
It sits in a wider ecosystem: Deep Agents for agents that plan and use subagents and file systems, LangGraph for low-level agent orchestration, LangSmith for evals, observability and debugging, and LangSmith Deployment for running long-lived agents. A JavaScript version, LangChain.js, is a separate project.
The quickstart is two steps: add the package and initialise a chat model by provider and name. Free courses are available at LangChain Academy. LangChain is MIT licensed.
Features
Key features
Standard model interface
One API across chat model providers.
Huge integration library
Models, tools, vector stores and retrievers.
Agents
Build agents, or use Deep Agents and LangGraph.
Flexible abstractions
High-level chains or low-level components.
Observability
Monitoring and evaluation through LangSmith.
Python and JS
LangChain.js for TypeScript.
Strengths
- Very large ecosystem and community
- Easy to switch model providers
- Free LangChain Academy courses
- MIT licensed
Limitations
- Abstractions can add complexity for simple apps
- Advanced orchestration lives in LangGraph
- Model providers bill for usage
Practical use cases
RAG apps
Connect models to your documents and databases.
Agents with tools
Let a model call APIs and functions.
Provider comparison
Swap models to find the best fit.
Installation
Install langchain
Commands come from LangChain's README. AIRepoHub hasn't run them yet. Steps are as of Nov 25, 2026; projects change often, so if a command doesn't work, check the project's latest README. View source
Prerequisites
- Python
- uv or pip
Supported systems
- Windows
- macOS
- Linux
- 1
Add LangChain
Shelluv add langchain
Configuration and API keys
| Setting | What it's for |
|---|
First run
- 1
Call a chat model
Textfrom langchain.chat_models import init_chat_modelmodel = init_chat_model("openai:gpt-5.5")result = model.invoke("Hello, world!")
langchain's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.
Your first project
Say hello to a model with LangChain
Initialise a chat model by provider and name and send it a message.
Before you start
- LangChain added to your project
- Credentials for your model provider (see the Integrations docs)
- 1
Install
Shelluv add langchain - 2
Initialise a model and invoke it
Textfrom langchain.chat_models import init_chat_modelmodel = init_chat_model("openai:gpt-5.5")result = model.invoke("Hello, world!")
What to expect
result holds the model's reply. Change the provider and model string to switch models without changing the rest of your code.
Next steps
- Try Deep Agents for a higher-level agent
- Use LangGraph for controllable agent workflows
- Take a free course at LangChain Academy
Costs and requirements
What it costs to run
- License
- MIT.Free
- Framework
- Free and open source.Free
- Model providers
- Billed by the providers you use.Depends
- LangSmith
- Separate product for evals and deployment; see langchain.com.Depends
Troubleshooting
Common setup issues
Need more control over agent steps
Use LangGraph, the low-level orchestration framework.
Can't find a provider
Check the Integrations docs for chat models and embeddings.
Questions
Ask on the LangChain community forum.
Alternatives
Similar AI repositories
hermes-agent
NousResearch
Personal AI agent from Nous Research that learns and improves the more you use it.
AutoGPT
Significant-Gravitas
Platform for building, deploying and running autonomous AI agents.
langflow
langflow-ai
Visual builder for creating and deploying AI agents and workflows by connecting blocks instead of writing code.
browser-use
browser-use
Python library that lets AI agents operate a real web browser.