Python + LangChain

LLM application orchestration in Python with LangChain and LangGraph: retrieval, tool calling and agents over hosted or self-hosted models.

  • PythonPython
  • LangChainLangChain
  • PydanticPydantic
Learning curve
Moderate
Status
Actively developed
Reviewed
November 2026
Best for
  • Retrieval-augmented generation over internal documents
  • Tool-calling agents with multi-step, stateful workflows (via LangGraph)
  • Products that need to switch or mix LLM providers
  • Prototyping LLM features quickly with ready-made integrations
Not ideal for
  • Training or fine-tuning models
  • Single summarisation or classification call

Overview

LangChain is a Python framework for building applications on top of large language models: chat models from many providers behind one interface, plus tools, retrievers, document loaders and vector-store integrations. It is split into packages: langchain-core for shared abstractions, provider packages such as langchain-openai and langchain-anthropic, langchain for high-level agents, and LangGraph for stateful, multi-step workflows. Teams reach for it to build RAG systems and tool-using agents without writing every integration by hand; it does not train or host models.

What's inside

A first RAG app is quick for Python developers. The harder parts are LangChain's many abstractions and changing APIs, LangGraph's state and checkpoint model, and LLM-specific skills: prompt design, retrieval tuning and evaluation.

  • Python

    Python

    Language

    The language the code is written in

    Learning: Easy

    Status: Active

  • LangChain

    LangChain

    Other

    Supporting tool

    Learning: Moderate

    Status: Active

  • Pydantic

    Pydantic

    Other

    Supporting tool

    Learning: Easy

    Status: Active

How it works

Application code assembles a chain or a LangGraph graph from chat models, prompts, retrievers and tools. At run time each step calls an LLM provider or a data source, passes structured messages along, and a checkpointer persists state between steps.

  1. 1.

    Language to other

    Python code defines tools as typed functions and structured outputs as Pydantic models, which LangChain converts into the JSON schemas chat models use for tool calling.

  2. 2.

    Other to database

    For retrieval, documents are loaded, split into chunks, embedded and stored in a vector store such as pgvector or Chroma; at query time a retriever fetches the most relevant chunks.

  3. 3.

    Other to backend

    A chat model integration sends the prompt, retrieved context and tool schemas to the provider's API (or a local Ollama or vLLM server) and streams the response back.

  4. 4.

    Other to other

    LangGraph runs the agent loop as a state graph: nodes call the model or execute requested tools, edges choose the next step, and a checkpointer (SQLite or Postgres) saves state for resumption and human approval.

  5. 5.

    Other to infrastructure

    Traces of every model and tool call go to LangSmith or another tracing tool such as Langfuse for debugging, cost tracking and evaluation.

Strengths and drawbacks

Strengths

  • Provider-agnostic model interface

    Chat models, embeddings and tool calling share one interface across providers, so moving between OpenAI, Anthropic, Google or a local Ollama model is mostly configuration, not a rewrite.

  • Large integration catalogue

    Document loaders, text splitters, vector stores and retrievers exist for most databases and file formats, which shortens RAG prototypes considerably.

  • LangGraph for controllable agents

    Explicit state graphs with checkpointing, interrupts for human approval, retries and streaming of intermediate steps give far more control than a free-running agent loop.

  • Tracing and evaluation

    LangSmith integration records every prompt, tool call and token count, and supports datasets and evaluators for regression-testing prompts and agents.

Drawbacks

  • Abstraction overhead

    Layers of runnables, callbacks and integration wrappers can hide what prompt is actually sent; for a single well-defined LLM call, the provider's own SDK is often clearer.

  • History of API churn

    The project went through several breaking reorganisations on the way to 1.0, with legacy chains moved out of the main package, so older tutorials and samples often no longer run.

  • Uneven integration quality

    Community integrations vary widely in maintenance and test coverage; pin versions and prefer the first-party provider packages.

  • Model costs and nondeterminism dominate

    Latency, rate limits, token spend and inconsistent outputs come from the models; production use needs caching, timeouts, fallbacks and evaluation suites regardless of framework.

Scores

Editorial ratings out of 10, comparable across every stack in the guide. They are judgement, not benchmarks. How we score

Speed of building
8.4 out of 10, catalog average 7.7

How quickly a team ships features

Ease of learning
7.0 out of 10, catalog average 7.2

Higher means easier to pick up

Scalability
6.4 out of 10, catalog average 7.6

How far it grows before a redesign

Performance
5.8 out of 10, catalog average 7.5

Speed of the running application

Maintainability
5.0 out of 10, catalog average 7.2

How well the codebase ages

Ecosystem
8.4 out of 10, catalog average 8.2

Libraries, hosting, docs and hiring

Flexibility
8.0 out of 10, catalog average 7.4

How many kinds of product it suits

How it scales

LangChain code is an application layer that scales like any Python service; the real limits are provider rate limits, model latency, token cost and vector-store performance.

Starting outMVP and first users
A script or notebook calling a hosted model, with a local Chroma or FAISS index over a few thousand documents.
GrowingReal traffic, a few engineers
A FastAPI service exposing a LangGraph agent with streaming responses, Postgres with pgvector for retrieval and checkpoints, and LangSmith or Langfuse tracing.
LargeHeavy traffic or data
Horizontally scaled stateless workers with persisted graph state, response caching, provider fallbacks and per-tenant rate limits, plus offline evaluation runs on every prompt change.
EnterpriseMany teams and regions
A central LLM gateway enforcing keys, quotas and PII redaction, several agent services sharing retrieval infrastructure, and governance over which models and data sources each application may use.

Where it fits

Common projects, from best fit to worst.

  • Internal knowledge-base assistant (RAG)

    Loaders, splitters, embeddings and retrievers cover ingestion and search, and tracing shows which chunks led to each answer.

    Great fit

  • Multi-step operations agent with human approval

    LangGraph checkpoints and interrupts let a person approve refunds or changes; reliability still depends on careful tool design and evaluations.

    Good fit

  • Single summarisation or classification call

    A direct provider SDK call with a Pydantic schema is simpler, has fewer dependencies and is easier to debug.

    Poor fit

  • Training or fine-tuning models

    LangChain has no training functionality; use PyTorch or Hugging Face Transformers.

    Avoid

Alternatives

Similar stacks, and when you would choose them instead.

Sources

Reviewed on November 19, 2026 against the documentation below. Found something out of date? Suggest a correction. Read our methodology.

Stacks that share technologies with Python + LangChain.