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

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.
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 |
|
|
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:
- Planning — turning a vague request into concrete subtasks with dependencies.
- Filesystem — read, write, edit, search. Real grep, glob, pagination, multi-file editing.
- Shell execution — running commands in sandboxed environments. Build, test, lint, deploy.
- Sub-agent delegation — spawning specialised workers for parallel tasks.
- Context management — when a conversation outgrows the model’s context window, compress intelligently instead of crashing.
- 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 |
|
|
Filesystem |
|
|
File editing |
Hashline (+5 to +64pp accuracy) + |
String replacement, with diff rendering in the CLI |
Shell execution |
Docker, Local, Kubernetes, Daytona, State, Composite backends |
|
Sub-agents |
sync, async, background, Q&A, nested spawning |
|
Multi-agent teams |
|
— (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 ( |
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 ( |
ACP ( |
Terminal CLI |
Built in ( |
Separate ( |
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 |
|
File storage, Docker sandbox, permissions, hashline |
|
Task tracking, subtasks, dependencies |
|
Delegation, background tasks, Q&A |
|
Context compression |
|
Cost tracking, input/output/tool guardrails |
|
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 |
|
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 |
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.
Summarize with AI
The LLM Book
The LLM Book explores the world of Artificial Intelligence and Large Language Models, examining their capabilities, technology, and adaptation.



