Pydantic Deep Agents vs LangChain Deep Agents: Which Python AI Agent Framework Should You Choose in 2026?

Photoroom
Kacper Włodarczyk
Agentic AI/Python Engineer
March 11, 2026
Group ()
TL;DR

Deep agents run autonomously for minutes or hours, planning, editing files, and coordinating sub-agents. Two open-source Python frameworks do this properly: LangChain Deep Agents and Pydantic Deep Agents, which we maintain. This comparison sets out where each wins. LangChain leads on observability, cloud sandboxes, evaluation, and a 27.9k-star community. Pydantic Deep Agents leads on live run forking, hashline file editing (+5 to +64pp accuracy), multi-agent teams, hard USD budget enforcement, and standalone installable components. The honest answer depends on your stack: already on LangGraph or Pydantic AI usually decides it; starting fresh, try both.

Table of content

Last updated: August 18, 2026

Deep agents run autonomously for minutes or hours, planning work, editing files, spawning sub-agents, and managing their own context. Think Claude Code, Cursor, or Devin. Two open-source Python frameworks do this properly: LangChain Deep Agents (built on LangGraph) and Pydantic Deep Agents (built on Pydantic AI).

We maintain Pydantic Deep Agents and have read every line of LangChain’s implementation. This is an honest comparison: what each does well, where each falls short, and which you should choose.

Both projects have moved fast since we first published this in March, so here is the state of play as of August 2026:

Pydantic Deep Agents

LangChain Deep Agents

Latest release

pydantic-deep 0.3.43 (5 Aug 2026)

deepagents 0.7.6 (13 Aug 2026)

GitHub stars

~1.0k

~27.9k

Licence

MIT

MIT

Shape

One package + a terminal CLI + 5 standalone libraries

One core package + CLI, code, ACP and partner packages

What are deep agents?

A regular AI agent calls a tool, gets a result, responds — the LLM drives each step directly. A deep agent still uses tool calls, but it runs inside a persistent harness that plans, manages state, executes tools repeatedly, and coordinates long-running work autonomously. It breaks down complex goals, maintains context across dozens of steps, and self-corrects.

Six capabilities make this possible:

  1. Planning — turning a vague request into concrete subtasks with dependencies.
  2. Filesystem — read, write, edit, search. Real grep, glob, pagination, multi-file editing.
  3. Shell execution — running commands in sandboxed environments. Build, test, lint, deploy.
  4. Sub-agent delegation — spawning specialised workers for parallel tasks.
  5. Context management — when a conversation outgrows the model’s context window, compress intelligently instead of crashing.
  6. Lifecycle hooks — intercept every tool call for safety checks, audit logging, cost tracking, or custom logic.

Both frameworks implement all six. The question is how — and the architectural choices create real trade-offs.

Getting started

Both give you a working deep agent in a handful of lines.

Pydantic Deep Agents:

from pydantic_deep import create_deep_agent, create_default_deps
from pydantic_ai_backends import LocalBackend

agent = create_deep_agent()
deps = create_default_deps(LocalBackend(root_dir="./workspace"))
result = await agent.run("Analyze this codebase and suggest improvements", deps=deps)

LangChain Deep Agents:

from deepagents import create_deep_agent

agent = create_deep_agent(
    model="openai:gpt-5.5",
    system_prompt="You are a research assistant.",
)
result = agent.invoke({"messages": "Analyze this codebase and suggest improvements"})

Pydantic Deep Agents also ships a terminal assistant, so you can skip the Python entirely:

curl -fsSL https://raw.githubusercontent.com/vstorm-co/pydantic-deep/main/install.sh | bash
export ANTHROPIC_API_KEY=sk-ant-...
pydantic-deep

LangChain’s equivalent is a separate install: deepagents-cli / deepagents-code.

How they work under the hood

LangChain Deep Agents layer middleware onto a LangGraph agent — filesystem, subagents, summarization, skills, memory, permissions, prompt caching, message eviction and more, each hooking into the lifecycle (before_agent, wrap_model_call, before_tools, after_tools). The result is a compiled state graph with native streaming and persistence. The payoff: LangGraph Studio and LangSmith give you visual state debugging and tracing that nothing else matches.

Pydantic Deep Agents compose toolsets and Pydantic AI capabilities on a plain Pydantic AI agent. Each feature is a vertical slice (pydantic_deep/features/<name>/), and the heavier subsystems ship as standalone PyPI packages: pydantic-ai-backend for filesystem and sandboxing, pydantic-ai-todo for planning, subagents-pydantic-ai for delegation. The payoff: you take only what you need. Want a sandbox for an agent you already have? pip install pydantic-ai-backend, done.

One architectural note worth flagging since March: cross-cutting concerns in Pydantic Deep Agents are no longer a bespoke middleware layer. They are Pydantic AI’s native Capabilities API — the same primitive the upstream framework uses — which is why our old pydantic-ai-middleware package is retired.

Feature comparison

Capability

Pydantic Deep Agents

LangChain Deep Agents

Planning

pydantic-ai-todo (subtasks, dependencies, Postgres/Redis)

write_todos / read_todos (in-state)

Filesystem

pydantic-ai-backend (read, write, edit, ls, glob, grep)

filesystem middleware (same ops)

File editing

Hashline (+5 to +64pp accuracy) + str_replace

String replacement, with diff rendering in the CLI

Shell execution

Docker, Local, Kubernetes, Daytona, State, Composite backends

execute via backend protocol

Sub-agents

sync, async, background, Q&A, nested spawning

task tool (isolated context, parallel)

Multi-agent teams

SharedTodoList, TeamMessageBus, AgentTeam

— (sub-agents stay isolated workers)

Live run forking

Fork a running agent into N branches, AI judge merges the winner

Context management

LLM summary + sliding window + eviction

Summarization + history offload + overflow clipping

Extension model

Pydantic AI Capabilities API + hooks + guardrails

~18 middleware modules

Cost tracking

USD budget enforced before the call (BudgetExceededError)

Cost reporting + configurable threshold warnings

Checkpointing

Save / rewind / fork, callable by the agent itself

LangGraph native checkpointer

Permissions

4 presets (DEFAULT, PERMISSIVE, READONLY, STRICT)

Per-tool HITL + auto-approval classifier

Visual debugging

Logfire

LangGraph Studio + LangSmith

Remote sandboxes

Docker, Daytona, Kubernetes, self-hosted remote backend server

Daytona, Modal, Runloop, Vercel, QuickJS

Editor integration

ACP (pydantic-deep[acp])

ACP (deepagents-acp, persistent sessions)

Terminal CLI

Built in (pydantic-deep)

Separate (deepagents-cli, deepagents-code)

Benchmarks

Harbor adapter (Terminal-Bench)

Unified evals suite + published scorecard

MCP

Native Pydantic AI MCP client

Bring your own MCP server

Type safety

Pydantic models end to end, Pyright + MyPy strict

LangChain typing

What LangChain Deep Agents does better

Observability and debugging

LangGraph Studio plus LangSmith is still the strongest debugging story in the space: visual state inspection, replay, evaluation and deployment in one loop. We use Logfire, which is excellent for tracing but is not a graph debugger. If your team’s workflow is built around inspecting agent state visually, this alone decides it.

Cloud sandboxes

Five first-party sandbox integrations — Daytona, Modal, Runloop, Vercel and QuickJS — versus our Docker, Daytona, Kubernetes and a self-hosted remote backend server. If you are already paying for Modal or Runloop, that is zero integration work.

Evaluation

LangChain ships a unified evals suite with a published scorecard across model groups. We have a Harbor adapter for Terminal-Bench, which is a benchmark runner, not an eval framework. Theirs is broader and better maintained.

Ecosystem gravity

27.9k stars against our 1k. More issues answered by strangers, more blog posts, more Stack Overflow answers, more people who have hit your bug before. This is a real advantage and it would be dishonest to pretend otherwise.

What Pydantic Deep Agents does better

Live run forking

An agent hits a fork in the road — “should I refactor this with a decorator or a context manager?” — and most tools force a single bet. Pydantic Deep Agents lets the run branch: fork_run splits an in-flight agent.run() into N parallel branches that share history up to the fork point, each with a copy-on-write filesystem overlay, its own steering message and its own budget_usd cap.

The coordinator resolves the fork with one of four acceptance modes — manual, auto, auto_with_fallback (default) or vote — and adopts the winning branch’s history as the run’s continuation. You can gate acceptance on a real test command:

from pydantic_deep import create_deep_agent, LiveForkCapability

agent = create_deep_agent(
    forking=LiveForkCapability(test_command="pytest -q", test_timeout_s=120),
)

In the terminal it is /fork, live per-branch panels streaming side by side, then /merge. No other deep agent framework does this today.

Hashline: more accurate file editing

Standard LLM file editing uses str_replace: the model reproduces the exact string to find, then the replacement. This breaks constantly — whitespace, indentation, partial matches. In our production workloads, string replacement failed roughly 30% of the time on smaller models.

Hashline takes a different approach. When the agent reads a file, each line carries a 2-character content hash:

1:a3|function hello() {
2:f1|  return "world";
3:0e|}

Instead of “find this exact string and replace it”, the instruction is “edit lines 1:a3 through 3:0e”. The model references lines by number and hash rather than reproducing content: fewer output tokens, no ambiguity, and if the file changed between read and edit, the hash check catches it.

Based on Can Boluk’s hashline research and benchmarked across 16 models: +5 to +64 percentage points over str_replace, with the largest gains on smaller models where exact string reproduction is hardest.

Multi-agent teams

Most frameworks support sub-agent delegation: spawn one agent, wait for it to finish. But sub-agents are isolated workers — they do not know about each other.

Pydantic Deep Agents adds Agent Teams: multiple agents with shared state. SharedTodoList is an asyncio.Lock-backed task list that agents claim from concurrently, with dependency tracking. TeamMessageBus gives per-agent queues for peer-to-peer messaging, routed through the subagent engine so a message reaches a member that is actually running. AgentTeam ties it together with spawn, assign, check, message and dissolve.

There is no central orchestrator deciding who does what — agents coordinate through shared state, claiming tasks and messaging each other as needed.

Checkpoint rewind and fork, callable by the agent

Long-running agents fail. If the model makes a wrong decision at step 40 of a 60-step task, most frameworks make you start over.

Both frameworks checkpoint. LangGraph’s checkpointer is battle-tested and saves at every graph node. The difference is that in Pydantic Deep Agents the agent itself can call rewind and fork as tools: it can save a labelled checkpoint before a risky operation and, if that fails, roll back autonomously without a human in the loop. Three save frequencies (every_tool, every_turn, manual_only), auto-pruning to the last 20, and forking a new session from any past checkpoint.

Hard budget enforcement

Cost tracking is on by default. Set a USD budget and the next model call raises BudgetExceededError before the API request goes out. LangChain reports cost and can warn you past a threshold; ours refuses to spend. An agent stuck in a retry loop is the most common way to burn money overnight in a long-running autonomous workflow.

Standalone, individually installable components

Each subsystem is its own package:

Package

What it does

pydantic-ai-backend

File storage, Docker sandbox, permissions, hashline

pydantic-ai-todo

Task tracking, subtasks, dependencies

subagents-pydantic-ai

Delegation, background tasks, Q&A

summarization-pydantic-ai

Context compression

pydantic-ai-shields

Cost tracking, input/output/tool guardrails

pydantic-deep

Everything combined, plus the CLI

pip install pydantic-deep gets you all of it. But if you only need guardrails on an agent you already have, pip install pydantic-ai-shields is a small dependency with no framework attached.

LangChain has moved in this direction too — deepagents, deepagents-cli, deepagents-code, deepagents-acp and the partner sandbox packages are separate installs — but the core middleware still comes as one block.

A terminal assistant in the same package

pydantic-deep is both the library and a Claude Code-style TUI: any model, any provider, Docker sandbox with named workspaces, MCP servers, skills, plan mode, checkpoints, mid-run steering, clipboard image paste, and a headless runner (pydantic-deep run) for CI. The framework and the assistant are the same harness, so anything you can wire up in Python you can drive from the terminal, and vice versa.

Decision guide

Your situation

Pick

Why

Already on LangGraph

LangChain

Zero migration, native integration

Need visual state debugging

LangChain

LangGraph Studio has no equivalent

Need Modal / Runloop / Vercel sandboxes

LangChain

First-party partner packages

Need the largest community

LangChain

27.9k stars against 1k

Already on Pydantic AI

Pydantic

Native toolset and capability integration

Need parallel exploration of one task

Pydantic

Live run forking with an AI judge

Need multi-agent teams

Pydantic

SharedTodoList, message bus, AgentTeam

Need accurate file editing

Pydantic

Hashline (+5 to +64pp across 16 models)

Need standalone components

Pydantic

5 libraries that each work alone

Need a hard USD ceiling

Pydantic

Enforced before the call, on by default

Need agent-callable rewind / fork

Pydantic

The agent recovers without a human

Want one tool that is a CLI and a library

Pydantic

Same harness, both surfaces

Starting fresh

Try both

Same pip install, same effort

Known limitations

Pydantic Deep Agents: no graph-level visual debugger, no Modal or Runloop integration, a benchmark adapter rather than an eval framework, and a much smaller community.

LangChain Deep Agents: string-replacement file editing, no shared-state agent teams, no live run forking, cost warnings rather than hard budget enforcement, and no agent-callable rewind.

Ready to see how agentic AI transforms business workflows?

Meet directly with our founders and PhD AI engineers. We will demonstrate real implementations from 30+ agentic projects and show you the practical steps to integrate them into your specific workflows—no hypotheticals, just proven approaches.

Start building

Pydantic Deep Agents: GitHub · Docs

LangChain Deep Agents: GitHub · Docs

Both are open source. Both install in one command. Star whichever you use.


Vstorm builds production AI agent systems and open-sources the tooling. We maintain Pydantic Deep Agents and its component libraries. For architecture discussions, get in touch.

Last updated: August 18, 2026

The LLM Book

The LLM Book explores the world of Artificial Intelligence and Large Language Models, examining their capabilities, technology, and adaptation.

Read it now