Introduction
LangChain is a framework for developing applications powered by large language models (LLMs).
LangChain simplifies every stage of the LLM application lifecycle:
- Development: Build your applications using LangChain's open-sourcecomponents andthird-party integrations.UseLangGraph to build stateful agents with first-class streaming and human-in-the-loop support.
- Productionization: UseLangSmith to inspect, monitor and evaluate your applications, so that you can continuously optimize and deploy with confidence.
- Deployment: Turn your LangGraph applications into production-ready APIs and Assistants withLangGraph Platform.
LangChain implements a standard interface for large language models and relatedtechnologies, such as embedding models and vector stores, and integrates withhundreds of providers. See theintegrations page formore.
pip install -qU "langchain[google-genai]"
import getpass
import os
ifnot os.environ.get("GOOGLE_API_KEY"):
os.environ["GOOGLE_API_KEY"]= getpass.getpass("Enter API key for Google Gemini: ")
from langchain.chat_modelsimport init_chat_model
model= init_chat_model("gemini-2.0-flash", model_provider="google_genai")
model.invoke("Hello, world!")
These docs focus on the Python LangChain library.Head here for docs on the JavaScript LangChain library.
Architecture
The LangChain framework consists of multiple open-source libraries. Read more in theArchitecture page.
langchain-core
: Base abstractions for chat models and other components.- Integration packages (e.g.
langchain-openai
,langchain-anthropic
, etc.): Important integrations have been split into lightweight packages that are co-maintained by the LangChain team and the integration developers. langchain
: Chains, agents, and retrieval strategies that make up an application's cognitive architecture.langchain-community
: Third-party integrations that are community maintained.langgraph
: Orchestration framework for combining LangChain components into production-ready applications with persistence, streaming, and other key features. SeeLangGraph documentation.
Guides
Tutorials
If you're looking to build something specific or are more of a hands-on learner, check out ourtutorials section.This is the best place to get started.
These are the best ones to get started with:
Explore the full list of LangChain tutorialshere, and check out otherLangGraph tutorials here. To learn more about LangGraph, check out our first LangChain Academy course,Introduction to LangGraph, availablehere.
How-to guides
Here you’ll find short answers to “How do I….?” types of questions.These how-to guides don’t cover topics in depth – you’ll find that material in theTutorials and theAPI Reference.However, these guides will help you quickly accomplish common tasks usingchat models,vector stores, and other common LangChain components.
Check outLangGraph-specific how-tos here.
Conceptual guide
Introductions to all the key parts of LangChain you’ll need to know!Here you'll find high level explanations of all LangChain concepts.
For a deeper dive into LangGraph concepts, check outthis page.
Integrations
LangChain is part of a rich ecosystem of tools that integrate with our framework and build on top of it.If you're looking to get up and running quickly withchat models,vector stores,or other LangChain components from a specific provider, check out our growing list ofintegrations.
API reference
Head to the reference section for full documentation of all classes and methods in the LangChain Python packages.
Ecosystem
🦜🛠️ LangSmith
Trace and evaluate your language model applications and intelligent agents to help you move from prototype to production.
🦜🕸️ LangGraph
Build stateful, multi-actor applications with LLMs. Integrates smoothly with LangChain, but can be used without it. LangGraph powers production-grade agents, trusted by Linkedin, Uber, Klarna, GitLab, and many more.
Additional resources
Versions
See what changed in v0.3, learn how to migrate legacy code, read up on our versioning policies, and more.
Security
Read up onsecurity best practices to make sure you're developing safely with LangChain.
Contributing
Check out the developer's guide for guidelines on contributing and help getting your dev environment set up.