LangChain is a comprehensive framework for building applications powered by large language models (LLMs), transforming simple prompts into production-ready AI agents. With the v1.0 release in October 2025, it has been streamlined around three pillars: create_agent (the new standard agent builder), middleware (composable hooks for customization), and standard content blocks (provider-agnostic message content). LangChain abstracts the complexity of chaining LLM calls, managing memory, integrating tools, and orchestrating retrieval-augmented generation (RAG) pipelines, while LangGraph (stateful graph workflows) and LangSmith (observability) complete the ecosystem. A critical mental model: every component implements the Runnable interface (invoke, stream, batch), and legacy functionality now lives in the separate langchain-classic package.
What This Cheat Sheet Covers
This topic spans 22 focused tables and 169 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Core Components
These are the building blocks you assemble into any LangChain app — chat models, prompts, output parsers, embeddings, vector stores, and the loaders and splitters that prep your data. The unifying idea is that nearly every one of them implements the same Runnable interface, so once you know how one works, you know how to invoke, stream, and batch them all.
| Component | Example | Description |
|---|---|---|
ChatOpenAI(model="gpt-4o")ChatAnthropic(model="claude-3-5-sonnet") | • Unified wrappers for conversational LLMs from OpenAI, Anthropic, Google, and more • returns structured AIMessage objects with metadata | |
from langchain.chat_models import init_chat_modelllm = init_chat_model("openai:gpt-4o")llm = init_chat_model("anthropic:claude-3-5-sonnet") | • Unified model initialization via provider:model string — no provider-specific import needed• supports fully configurable runtime model selection via config["configurable"]• recommended v1.0 pattern for provider-agnostic code | |
OpenAIEmbeddings()HuggingFaceEmbeddings() | • Convert text to vectors for semantic search • used with vector stores; supports batch processing for efficiency | |
PromptTemplate(template="Answer: {question}")ChatPromptTemplate.from_messages([...]) | • Templating system for dynamic prompt construction • supports f-string syntax, Jinja2, and chat message formatting | |
JsonOutputParser()PydanticOutputParser(pydantic_object=MyModel) | • Extract structured data from LLM text responses • handles JSON, Pydantic models, lists, and custom formats with validation | |
chain.invoke(input)chain.stream(input)chain.batch([inputs]) | • Unified execution protocol for all LangChain components • enables invoke (single), stream (tokens), batch (multiple), and async variants |