Pydantic AI vs LangChain is really two questions wearing one trench coat: which framework is technically better, and which one is safe to build on today. I checked both before writing a line of code for this post. LangChain’s agent layer has settled on create_agent running on LangGraph, currently version 1.2.6. It’s already confirmed in production at Klarna, Uber, and Elastic. Pydantic AI just shipped its sixth 2.0 beta. That beta line introduces a new capabilities system rewriting several core patterns, while 1.106 stays the stable line most people should actually install right now. Here’s real, current code for both, a decision table, and my verdict.
- Pydantic AI is lean and type-safe — a model string, a system prompt, and
@agent.toolgets you a working agent fast. - LangChain’s
create_agentruns on LangGraph, now at v1.2.6, with the deepest production track record of any Python agent framework. - Pydantic AI is mid-migration. Its 2.0 rewrite (six betas deep) will replace several current patterns — a real factor if you’re starting new code today.
- Neither wins outright. The honest answer depends on whether you value type safety and a lean footprint, or ecosystem depth and production mileage.
The Frameworks at a Glance#
Both frameworks solve the same core problem — give a model tools and let it decide when to call them — but they come from different design philosophies.
Pydantic AI is built by the team behind Pydantic, and it shows. Agents, tools, and structured outputs are all validated the same way you’d validate a request body. It’s a comparatively small dependency footprint. If you already use Pydantic elsewhere in your stack, the mental model transfers directly.
LangChain, by contrast, is the ecosystem play. Its create_agent function is the current recommended entry point. It sits on top of LangGraph — a lower-level state-graph runtime that handles branching, retries, persistence, and human-in-the-loop interrupts. LangChain also ships deep agents (the deepagents package) as a more batteries-included option. It adds planning and a virtual filesystem built in, out of the box.
Both frameworks can build the same agent. The real difference is dependency weight, ecosystem maturity, and — right now — API stability. That last one matters more than usual this year.
The Pydantic AI vs LangChain Decision Table#
Line these up on the criteria that actually change your day-to-day, not the marketing copy.
| Criterion | Pydantic AI | LangChain / LangGraph |
|---|---|---|
| Core idea | Type-validated agent, Pydantic-native | Graph-based orchestration on LangGraph |
| Current stable version | 1.106.0 (Jun 5, 2026) | LangGraph 1.2.6 |
| API stability right now | 2.0 beta in progress (6 betas) — breaking changes coming | Stable, iterating in minor/patch releases |
| Learning curve | Short if you know Pydantic | Short to start, deeper as you add memory/tracing |
| Built-in memory / state | Manual, or via your own store | LangGraph checkpointer (InMemorySaver or persistent) |
| Observability | Built-in OpenTelemetry instrumentation, bring your own backend | LangSmith — a dedicated tracing, evals, and deployment product |
| Confirmed production users | Couldn’t verify any named users — that’s a gap in my research, not evidence of absence | Klarna, Uber, Elastic (verified on LangChain’s own site) |
| Dependency footprint | Lean | Larger (langchain + langgraph + optional deepagents) |
The single most important row for a 2026 decision is API stability. Pydantic AI’s core Agent + @agent.tool pattern is stable in 1.x. But several adjacent APIs are already deprecated in favor of the incoming capabilities system. Code you write today may need a pass when 2.0 goes final.
The Pydantic AI Way#
Here’s a minimal but real Pydantic AI agent, using the current stable 1.x API — a model string, a system prompt, and a decorated tool function.
from pydantic_ai import Agent, RunContext
weather_agent = Agent(
"openai:gpt-5.2",
system_prompt="Provide a short weather forecast for the location given.",
)
@weather_agent.tool
async def get_weather(ctx: RunContext, city: str) -> str:
"""Get the current weather for a city."""
return f"It's 24°C and sunny in {city}."
result = weather_agent.run_sync("What's the weather in Austin?")
print(result.output)run_sync blocks until the model finishes its turn, including any tool calls, and hands back a RunResult. result.output is validated against the type you declared — a plain string here, but it can just as easily be a Pydantic BaseModel for structured extraction. That validation step is the whole pitch of this framework. The model’s answer either matches your schema, or you get a typed error — never a string you have to hope is well-formed.
This example targets the current stable 1.x line. Pydantic AI’s 2.0 betas already deprecate prepare_tools=, event_stream_handler=, and history_processors= in favor of a new capabilities=[...] list — if you’re reading this after 2.0 goes stable, check the migration notes before assuming this snippet still runs unchanged.
The LangChain Way#
LangChain’s current recommended entry point is create_agent, which builds on LangGraph underneath. The same weather agent looks like this:
from langchain.agents import create_agent
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return f"It's 24°C and sunny in {city}."
agent = create_agent(
model="openai:gpt-5.5",
tools=[get_weather],
system_prompt="Provide a short weather forecast for the location given.",
)
result = agent.invoke(
{"messages": [{"role": "user", "content": "What's the weather in Austin?"}]}
)
print(result["messages"][-1].content_blocks)The shape is familiar — model, tools, system prompt. But the return value is a full message list, not a single typed value, because create_agent is built for multi-turn conversations by default. Add a checkpointer — LangGraph’s InMemorySaver, or a persistent store in production — and the same agent remembers earlier turns across calls. Want more built in without wiring it yourself? Planning, a virtual filesystem, and subagents come from LangChain’s deepagents package, via create_deep_agent with the same call signature.
LangChain agents and deep agents fill the same role at different capability levels. Start with create_agent for fine-grained control; reach for create_deep_agent when the task is complex enough to want planning and subagents out of the box.
My Verdict#
Neither framework is the wrong choice. The honest answer depends on what you’re optimizing for — not on which one is “better” in the abstract.
Pick LangChain / LangGraph if you want the deepest ecosystem and the strongest verifiable production track record available in a Python agent framework today. LangSmith’s tracing and evals are a real advantage once something goes wrong in production. Named users at Klarna, Uber, and Elastic also mean the rough edges at scale are more likely already found — and fixed — by someone else. It’s a similar calculus to OpenAI Agents SDK vs LangGraph: ecosystem maturity tends to win for teams shipping to production this quarter.
I could name three LangGraph production users because LangChain publishes case studies. I could not find an equivalent, named list for Pydantic AI — it has real production users, I just couldn’t verify who. That’s a gap in what’s publicly documented, not proof one framework is more deployed than the other, and it’s worth weighing this verdict with that asymmetry in mind rather than taking it as a clean head-to-head.
Pick Pydantic AI if you want a lean, type-safe agent and you’re comfortable adapting when 2.0 lands. The type validation on tool inputs and structured outputs is genuinely nice to work with. If your stack already leans on Pydantic, the framework feels like an extension of code you already write, not a new mental model bolted on top.
My actual recommendation for most teams starting today: default to LangChain’s create_agent on LangGraph. That’s specifically because of the API stability gap. A framework mid-way through six betas of breaking changes is a real cost to absorb in a production codebase — however much you like its design.
Quick Recap#
- Pydantic AI: lean, type-safe, stable at 1.106 — but 2.0 is coming with real breaking changes.
- LangChain / LangGraph:
create_agenton a mature, stable LangGraph (1.2.6), with LangSmith and confirmed production users. - Both can build the exact same tool-calling agent — the difference is in stability, ecosystem, and how much you’re willing to adapt later.
- Default recommendation: LangChain/LangGraph for new production work today; Pydantic AI if you value type safety and can tolerate a migration later.
Conclusion#
Pydantic AI vs LangChain isn’t a contest with one clear winner. It’s a trade between a lighter, type-safe framework mid-migration and a heavier, ecosystem-rich one with a longer production record. Check the version numbers before you commit either way. Frameworks in this space move fast enough that a comparison from even six months ago can already be stale.
Which one are you building on right now, and has a breaking change ever bitten you mid-project? Tell me in the comments — I’m especially curious how teams already on Pydantic AI 1.x are planning their 2.0 migration.
Read next: Best AI Agent Frameworks 2026 — the broader roundup this comparison zooms into.
- New to agent frameworks? What Are AI Agents? A Complete Guide covers the concepts both frameworks build on.
- Want the deeper Pydantic AI build? Pydantic AI Tutorial: Type-Safe Agents in Python walks through a full example.
- Ready to build with LangGraph? LangGraph Tutorial: Build Your First Agent is the hands-on companion to this comparison.

