AP
Agentic Playbook
langchain·Beginner·Last tested: 2026-03·~5 min read

LangChain

LangChain is a Python framework for building agents and LLM-powered applications. It provides interoperable components and third-party integrations to simplify AI application development while maintaining flexibility as the technology evolves.

Key Features

  • Model interoperability — Swap between different LLM providers (OpenAI, Anthropic, etc.) through standardized interfaces
  • Rich integrations — Connect to vector stores, tools, retrievers, and external data sources
  • Agent orchestration — Build complex workflows with LangGraph for controllable agent behavior
  • Real-time data augmentation — Easily connect LLMs to diverse internal and external systems
  • Modular architecture — Component-based design for rapid prototyping and iteration

Installation

pip install langchain
# or with uv
uv add langchain
Info

For JavaScript/TypeScript, use LangChain.js instead.

Basic Usage

from langchain.chat_models import init_chat_model

# Initialize a chat model
model = init_chat_model("openai:gpt-4")

# Send a message
result = model.invoke("Hello, world!")
print(result)
Tip

For advanced agent workflows, explore LangGraph for low-level orchestration and LangSmith for debugging and deployment.

Notable Details

  • License: MIT
  • Language: Python
  • Community: 130K+ GitHub stars with active open-source ecosystem
  • Ecosystem: Integrates with LangGraph (agent orchestration), LangSmith (observability), and Deep Agents (complex task handling)