The LangChain ecosystem

LangChain · Essentials · 8 min

LangChain is split into many packages; knowing which one does what avoids import errors and outdated tutorials.

LangChain is a family of packages rather than one library:

  • langchain-core: the base abstractions (messages, chat model and embedding interfaces, prompts, runnables, tools, documents, vector store interface). Everything else depends on it.
  • langchain: the high-level entry point. In 1.x it is deliberately small: init_chat_model, create_agent with middleware, and re-exports of common core pieces.
  • Provider packages such as langchain-openai, langchain-anthropic, langchain-google-genai, langchain-ollama: concrete model and embedding classes. Install only the providers you use.
  • langchain-text-splitters and langchain-community: splitters, document loaders and many community integrations.
  • LangGraph: a lower-level library for stateful, multi-step agent workflows with persistence, streaming and human-in-the-loop. LangChain agents run on it.
  • langchain-classic: legacy chains and retrievers from 0.x (such as RetrievalQA) kept for migration.
  • LangSmith: a hosted platform for tracing, evaluation and deployment, configured with environment variables.

A lot of material online targets 0.1 to 0.3 and uses APIs like LLMChain, initialize_agent or AgentExecutor, which are legacy now. In 1.x the building blocks are chat models, messages, LCEL runnables, tools and create_agent/LangGraph.

API keys are read from environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY...). Keep them out of code.

Example

# pip install -U langchain langchain-openai langgraph
import importlib.metadata as md

for pkg in ["langchain", "langchain-core", "langgraph", "langchain-openai"]:
    try:
        print(f"{pkg:18} {md.version(pkg)}")
    except md.PackageNotFoundError:
        print(f"{pkg:18} not installed")
# langchain          1.x
# langchain-core     1.x
# langgraph          1.x
# langchain-openai   1.x

from langchain_core.messages import HumanMessage    # core abstractions
from langchain.chat_models import init_chat_model  # high-level helpers
from langchain.agents import create_agent           # agents (built on LangGraph)

Remember

  • langchain-core holds abstractions; provider packages hold model integrations
  • LangGraph powers agents and stateful workflows
  • Pre-1.0 APIs like LLMChain and AgentExecutor are legacy (langchain-classic)

Watch out for

  • Following a 0.1-era tutorial that imports from langchain.llms or uses initialize_agent, which no longer exists in 1.x.

Check yourself

  1. You need ChatAnthropic. Which package provides it?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.langchain.com/oss/python/langchain/overview

Builds on

Nothing: this is a foundation.

Unlocks