# Pydantic AI vs LangChain vs LangGraph: how they differ and which to use

> LangChain agents run on LangGraph, so the choice is a typed agent loop (Pydantic AI), a minimal agent harness you extend (LangChain) or a graph you write (LangGraph).

Source: https://www.honeyhive.ai/learn/pydantic-ai-vs-langchain-vs-langgraph (updated 2026-11-08)

Pydantic AI, LangChain and LangGraph are not three equal rivals. LangChain's agents are [built on LangGraph](https://docs.langchain.com/oss/python/langchain/overview), so LangChain vs LangGraph is a choice of layer. Pydantic AI is the separate one: a Python framework from the Pydantic team that is [typed end to end](https://pydantic.dev/docs/ai/overview/). Pick Pydantic AI when typed inputs and outputs drive the design, LangChain's `create_agent` when you want a ready agent you extend with middleware, and LangGraph when you want to write the control flow as a graph yourself.

Each has its own page: [Pydantic AI](/learn/pydantic-ai-framework), [LangChain](/learn/langchain-framework) and [LangGraph](/learn/langgraph-framework). Below, the same criteria side by side, from each project's own docs.

## How the layers fit

```text
 LangChain  create_agent + middleware
     |
     v  built on
 LangGraph  state, nodes, edges, checkpoints

 Pydantic AI  Agent + tools + output type
     |
     v  optional
 Pydantic Graph, Evals, durable engines
```

LangGraph's docs say [higher-level options such as LangChain agents sit on top of it](https://docs.langchain.com/oss/python/langgraph/overview). The LangChain docs call `create_agent` ["a minimal, highly configurable harness"](https://docs.langchain.com/oss/python/langchain/overview) that you extend with middleware for things like guardrails and retries. Pydantic AI keeps one typed agent loop at the center and offers [Pydantic Graph](https://pydantic.dev/docs/ai/overview/) for cases where "one agent loop is not enough".

## Side by side

| | Pydantic AI | LangChain | LangGraph |
|---|---|---|---|
| Core idea | Typed agent: model, tools, output type, dependencies ([overview](https://pydantic.dev/docs/ai/overview/)) | An agent harness: `create_agent` with a model, tools, prompt and middleware ([overview](https://docs.langchain.com/oss/python/langchain/overview)) | Graph of nodes and edges over shared state ([overview](https://docs.langchain.com/oss/python/langgraph/overview)) |
| Level | Agent framework, with a graph package for harder flows | Higher-level agent API | Low-level; does not prescribe prompts or agent architecture |
| Who writes control flow | The agent loop runs it; Pydantic Graph if you want it explicit | The agent loop runs it; middleware changes behavior | You, as nodes and edges; fixed code steps and LLM steps can mix |
| Structured output | Tool arguments and final answers validated against your types by default ([overview](https://pydantic.dev/docs/ai/overview/)) | `response_format` with provider-native or tool-based strategies; Pydantic models return validated instances ([docs](https://docs.langchain.com/oss/python/langchain/structured-output)) | Whatever your nodes do; the LangChain layer provides the above |
| Models | Swap with a string; "virtually every model and provider" ([overview](https://pydantic.dev/docs/ai/overview/)) | One interface over OpenAI, Anthropic, Google, Ollama, AWS Bedrock and others ([overview](https://docs.langchain.com/oss/python/langchain/overview)) | Any model you call inside a node; LangChain models plug in |
| Long-running work | Durable execution through nine engines, including Temporal, DBOS and Prefect, one per agent ([durable execution](https://pydantic.dev/docs/ai/integrations/durable_execution/overview/)) | Through LangGraph | Built-in checkpointing: "Checkpoint state and resume after failures or pauses" ([overview](https://docs.langchain.com/oss/python/langgraph/overview)) |
| Human approval | Tool approval is built in ([overview](https://pydantic.dev/docs/ai/overview/)) | `HumanInTheLoopMiddleware` per tool; needs a checkpointer ([docs](https://docs.langchain.com/oss/python/langchain/human-in-the-loop)) | "Pause execution, inspect or edit state, then continue" ([overview](https://docs.langchain.com/oss/python/langgraph/overview)) |
| MCP | `MCP` capability is the recommended route ([MCP docs](https://pydantic.dev/docs/ai/mcp/overview/)) | `MCPAdapter`, a beta namespace needing `langchain[mcp]>=1.4.0` ([docs](https://docs.langchain.com/oss/python/langchain/mcp)) | Through LangChain's adapter |
| Evals | Pydantic Evals grades outputs and tool-call trajectories on datasets or live traffic ([overview](https://pydantic.dev/docs/ai/overview/)) | The `agentevals` package scores agent trajectories against a reference or with an LLM judge ([evals docs](https://docs.langchain.com/oss/python/langchain/evals)) | `agentevals` also has graph trajectory evaluators that score the nodes visited ([README](https://github.com/langchain-ai/agentevals)) |
| Tracing | OpenTelemetry-native; any OpenTelemetry backend works ([overview](https://pydantic.dev/docs/ai/overview/)) | Traced through instrumentors such as OpenInference's ([example](https://docs.honeyhive.ai/v2/integrations/langchain)) | The same LangChain instrumentor traces graphs ([example](https://docs.honeyhive.ai/v2/integrations/langgraph)) |
| Python | 3.11 or later, MIT ([PyPI](https://pypi.org/project/pydantic-ai/)) | 3.10 or later, MIT ([PyPI](https://pypi.org/project/langchain/)) | 3.10 or later, MIT ([PyPI](https://pypi.org/project/langgraph/)) |
| Install | `pip install pydantic-ai` ([overview](https://pydantic.dev/docs/ai/overview/)) | `pip install langchain` ([PyPI](https://pypi.org/project/langchain/)) | `pip install -U langgraph` ([overview](https://docs.langchain.com/oss/python/langgraph/overview)) |

For what MCP is, see [Model Context Protocol](/learn/model-context-protocol).

## Pydantic AI vs LangChain

Both give you a working agent in a few lines and both validate structured output. The difference is where the types sit.

In Pydantic AI, types are the organizing idea: an `output_type`, a `deps_type` for injected dependencies, and tools whose signatures become schemas. A failed validation prompts the model to retry ([overview](https://pydantic.dev/docs/ai/overview/)). LangChain's agent is a smaller harness that you shape with middleware and a `response_format`; it validates Pydantic outputs and feeds schema errors back to the model under its tool strategy ([structured output](https://docs.langchain.com/oss/python/langchain/structured-output)).

Two other differences matter in practice. LangChain 1.0 moved legacy chains and retrievers into a separate `langchain-classic` package ([migration guide](https://docs.langchain.com/oss/python/migrate/langchain-v1)), so old tutorials may import things that moved. Pydantic AI had its own breaking 2.0 release, covered on its [framework page](/learn/pydantic-ai-framework). Check the version a tutorial targets in either case.

| If you need | Lean toward |
|---|---|
| Typed output and typed dependencies as the core design | Pydantic AI |
| A ready agent with middleware for guardrails, retries and routing | LangChain |
| One model interface across many providers | Either; both document it |
| Evals on live production traffic as well as datasets | Pydantic AI (Pydantic Evals) |
| Python 3.10 support | LangChain; Pydantic AI needs 3.11 |

## Pydantic AI vs LangGraph

This is a comparison of an agent loop with a graph. Pydantic AI runs the loop and lets you add [Pydantic Graph](https://pydantic.dev/docs/ai/overview/) when you need typed control flow. LangGraph starts from the graph: you define nodes, edges and state, and the docs say it [does not prescribe prompts or agent architecture](https://docs.langchain.com/oss/python/langgraph/overview).

Durability differs in shape. LangGraph checkpoints state itself. Pydantic AI hands durability to an engine such as Temporal, which [journals model requests and tool calls and replays completed ones after a crash](https://pydantic.dev/docs/ai/integrations/durable_execution/overview/); saving and forking runs is a separate feature in its harness package.

| If you need | Lean toward |
|---|---|
| Loops, branches and parallel paths you design node by node | LangGraph |
| One agent with typed tools and output, little orchestration | Pydantic AI |
| Checkpoints built into the core package | LangGraph |
| Run agents on an engine your team already operates (Temporal, DBOS, Prefect) | Pydantic AI |

## LangChain vs LangGraph

Use LangChain when one agent with tools is enough. Use LangGraph when you need to write the flow. They are not exclusive: LangChain's docs list a custom workflow built with LangGraph as one [multi-agent pattern](https://docs.langchain.com/oss/python/langchain/multi-agent), "mixing deterministic logic and agentic behavior". Human approval shows the layering: LangChain's middleware needs a checkpointer, which comes from the LangGraph layer ([docs](https://docs.langchain.com/oss/python/langchain/human-in-the-loop)).

## Which to choose

| Your situation | Start with |
|---|---|
| One agent, typed results, and the types are the point | Pydantic AI |
| One agent, fast start, extend with middleware | LangChain `create_agent` |
| A multi-step workflow with branches, loops and pauses | LangGraph |
| Existing LangChain code that needs a custom flow | Add LangGraph in the same app |
| Long runs that must survive deploys on Temporal or DBOS | Pydantic AI, or LangGraph checkpoints |
| A plain function could do the job | None of them |

This table is a judgement from the docs, not a benchmark. The docs describe features, not how each performs on your task, so test on your own data. See [LLM evaluation](/learn/llm-evaluation) and [testing AI agents](/learn/testing-ai-agents). For ideas behind the criteria, see [agent orchestration](/learn/agent-orchestration), [human-in-the-loop AI](/learn/human-in-the-loop-ai) and [multi-agent systems](/learn/multi-agent-systems). Other options: [OpenAI Agents SDK](/learn/openai-agents-sdk-framework), [CrewAI](/learn/crewai-framework) and [LangGraph vs CrewAI vs AutoGen](/learn/langgraph-vs-crewai-vs-autogen).

## Tracing any of the three

Whichever you pick, agent runs are hard to debug without traces of each model call and tool call. For the method, see [agent tracing](/learn/agent-tracing) and [LLM observability](/learn/llm-observability). HoneyHive documents integrations for all three: [Pydantic AI](https://docs.honeyhive.ai/v2/integrations/pydantic-ai), [LangChain](https://docs.honeyhive.ai/v2/integrations/langchain) and [LangGraph](https://docs.honeyhive.ai/v2/integrations/langgraph). The LangChain page says the same instrumentor also traces LangGraph graphs.

## FAQ

### Is LangChain built on LangGraph?

Yes, for agents. The LangChain docs say its [agents are built on LangGraph](https://docs.langchain.com/oss/python/langchain/overview), which supplies durable execution, human-in-the-loop support and persistence. `create_agent` replaced LangGraph's prebuilt `create_react_agent` in LangChain 1.0, per the [v1 migration guide](https://docs.langchain.com/oss/python/migrate/langchain-v1).

### Is Pydantic AI built on LangChain?

No. Pydantic AI is an agent framework from the team behind the Pydantic validation library, with its own agent loop, tools, evals and graph package ([overview](https://pydantic.dev/docs/ai/overview/)). See [What is Pydantic AI](/learn/pydantic-ai-framework).

### Should I use LangChain or LangGraph?

Start with LangChain's `create_agent` if one agent with tools fits the job. Move to LangGraph when you need to define the nodes, edges and state yourself. LangGraph's docs describe it as a [low-level framework](https://docs.langchain.com/oss/python/langgraph/overview) that LangChain agents sit on, so you can mix them in one app.

### Which one validates structured output?

All three can return typed output. Pydantic AI validates tool arguments and final answers against your types by default ([overview](https://pydantic.dev/docs/ai/overview/)). LangChain's `create_agent` takes a `response_format` and returns validated instances for Pydantic models ([structured output](https://docs.langchain.com/oss/python/langchain/structured-output)). In LangGraph you add that step to your graph.

### Are they free and open source?

The packages are MIT licensed on PyPI for [Pydantic AI](https://pypi.org/project/pydantic-ai/) and [LangChain](https://pypi.org/project/langchain/). You still pay your model provider, and any hosted services you add.
