CLI 需先设置 ANTHROPIC_API_KEY 等模型密钥才能启动;Windows 或手动安装需改用 pip install "pydantic-deep[cli]";浏览器自动化需额外安装 pydantic-deep[browser]。
pydantic-deepagents
vstorm-coMIT活跃维护自托管的终端 AI 编程助手,也是它背后的 Python 框架,基于 Pydantic AI 支持任意模型,提供工具调用、沙箱执行、多智能体协作和无限上下文。
Open-source, self-hosted Claude Code - a terminal AI assistant and the Python framework behind it. Tool-calling, sandboxed execution, multi-agent teams, skills, checkpoints, unlimited context - on Pydantic AI, any model.
curl -fsSL https://raw.githubusercontent.com/vstorm-co/pydantic-deepagents/main/install.sh | bash
pydantic-deepREADME 未说明显存或 GPU 要求;支持通过 Ollama 运行本地模型,也可用 Docker 沙箱执行。
开源自托管的 Claude Code 替代品,既是终端 AI 助手,也是可二次开发的 Python 框架
自托管的终端 AI 编程助手,也是它背后的 Python 框架,基于 Pydantic AI 支持任意模型,提供工具调用、沙箱执行、多智能体协作和无限上下文。
核心能力
- 用 create_deep_agent() 一次调用装配完整深度智能体
- Live Run Forking 把单次运行拆成并行分支并由 AI 裁判择优合并
- 分支用写时复制文件系统隔离,各自独立预算与指令
- 内置工具调用、子智能体委派、技能、检查点与上下文压缩
- 基于 Pydantic AI,可接 Claude、GPT、Gemini、Ollama 等任意模型
容易踩的坑
- 0.3.50最新正式版2026-10-06 · 2026-10-06 10:47 UTC
Fixed
- Context compression used a different provider when
modelwas aModelinstance. Only a model string was inherited, so an agent built on, say, anOpenAIChatModelfor an OpenAI-compatible gateway summarized withDEFAULT_SUMMARIZATION_MODEL- a provider the deployment may have no key for.summarization_modelnow defaults to the primary model either way, and accepts aModelinstance itself.
- Context compression used a different provider when
- 0.3.492026-10-06 · 2026-10-06 09:36 UTC
查看更新说明
Added
-
The CLI's
/modelpicker lists local models under "Local (discovered)": the models Ollama has pulled, and what an OpenAI-compatible server (llama.cpp, LM Studio, vLLM) serves at{base_url}/models. Discovery runs in the background with a two-second timeout; a server that is down adds nothing. (#216) -
Messages from outside the terminal into a live CLI session.
pydantic-deep tui --listenaccepts messages on a loopback HTTP endpoint (POST /messages, a bearer token in.pydantic-deep/session-endpoint.json, readable by the owner only), andDeepApp.inject_external_message()is the same in process. A Slack thread, a Jira comment, CI or a webhook can steer a running session or queue a follow-up, and starts a turn in an idle one; the message is labelled with itssource, and waits behind a turn the session is about to start rather than running beside it. A session that cannot take it - no agent, an active fork, a full queue - refuses with the reason. (#181)
Fixed
-
An
ollama:model runs in the CLI withoutOLLAMA_BASE_URL. Pydantic AI refuses Ollama with no host, so the documented defaultlocalhost:11434never worked; the CLI now uses it when the variable is unset. -
Steering that arrives too late for a run is no longer lost or delayed. The CLI drained one stale steering message after a run and left the rest for some later turn; it now drains them all. Ones from outside the terminal become follow-ups instead of being dropped with a warning only the terminal shows.
-
- 0.3.482026-10-06 · 2026-10-06 08:53 UTC
查看更新说明
Added
memory_namespace=oncreate_deep_agentandDeepAgentSpec: a segment betweenmemory_dirand the agent's name, fixed or resolved per run (a user id, say), for several users sharing one workspace. The model never sees it. Each/-separated part is letters, digits,_,-and.; a fixed one that is not is refused when the agent is built.build_memory_capability(), which builds theMemorycapability the waycreate_deep_agentdoes.
Changed
- Memory is the
pydantic-ai-harnessMemorycapability. Each agent keeps a notebook of Markdown files in the run's workspace, at the same{memory_dir}/{agent_name}/MEMORY.mdas before, so existing notebooks are read unchanged.MEMORY.mdis added to each request as user-role context rather than to the instructions, and the tools arewrite_memory(append, or replace withold_text=- whatupdate_memorydid),read_memory,search_memoryanddelete_memory. Subagents keep their own notebooks in the same store; one with its ownagent_factoryis handed the memory tools intoolsetsto pass on, and a prebuiltagentis used as it is.tool_searchleaves memory loaded, so the notebook is still injected. Requirespydantic-ai-harness>=0.52.0. (#236, from #187 by @OchnikBartek) - A run with memory needs a workspace. The harness refuses to start a run
that has none, where pydantic-deep's own memory skipped itself: an agent built
with
workspace=Falsemust be givenworkspace=per run, orinclude_memory=False. - Memory files are bounded. The tools read and change files up to 65,536
characters; past that,
write_memoryrefuses to edit from a partial read.build_memory_capability(max_memory_size=...)raises the bound. TestModel(call_tools="all")now retries on memory. It callsread_memorywith a made-up file name, which the harness answers with a retry; passinclude_memory=Falseto agents in tests that are not about memory.memory_pin_markerno longer pins. The harness keeps the tail ofMEMORY.mdwhen it truncates and has no pinned section; setting it now warns.
Deprecated
- pydantic-deep's own memory API -
AgentMemoryToolset,MemoryCapability,MemoryFile,MemoryAccessError,load_memory,format_memory_prompt,DEFAULT_MAX_MEMORY_LINES,DEFAULT_PIN_END_MARKERand the memory tool descriptions. They still import, with aDeprecationWarning, and nothing uses them.
Removed
DEFAULT_TEAM_MEMBER_MODEL. A member without a model now runs on the team lead's.
Fixed
- A tool that returns the same thing whenever it works can say so. Stuck-loop
detection's no-op check compares results only, so attaching three different
files - each answering
True- read as "the operation has no effect", and the retry replaced the real result. A tool now opts out where it is defined:metadata={"stuck_loop_detection": {"noop": False}}skips the result check (identical calls are still caught), andmetadata={"stuck_loop_detection": False}every check. (#237, fixes #208) - Team members are built like the lead's subagents.
spawn_teambuilt members through a stale copy of the subagent factory: every member ran on a hardcoded Anthropic model, with web search the lead had turned off (failing the whole run withoutANTHROPIC_API_KEYor theduckduckgoextra), and without the shell or the domain tools a delegate gets. Members now use the subagent factory: the lead's model unlessTeamMemberSpec.modelnames one, the lead's web tools, eviction, shell and workspace, andsubagent_extra_toolsets. (#238, fixes #198)
- 0.3.472026-10-06 · 2026-10-06 00:17 UTC
查看更新说明
Fixed
- Subagents keep the parent's eviction settings. The default subagent factory
built every subagent with the default
EvictionCapability, whatever the parent was given:eviction_token_limit,max_binary_contentandon_evictionnow carry through, andeviction_token_limit=Noneleaves subagents without the default capability as it does the parent. (#214, fixes #206) - A follow-up queued as a run ends is delivered. A message arriving after the
TUI's post-run drain still saw the run as active and sat queued until some later
run ended; the worker now drains follow-ups when it stops. A cancelled run
discards only follow-ups typed locally, so ones from an external
sourcestart a fresh turn. (#233, from #197 by @OchnikBartek)
Added
- Message-queue
sourcelabels and backpressure. A message'smetadata["source"]reaches the model ([steering via slack] ...), the logs and the span;MessageQueue(max_pending=...)(default 100 per priority) refuses past the cap withQueueFullError;discard_follow_up(keep=...)andqueued_source()are public. (#233) - Enterprise configuration for hosted OAuth MCP servers.
MCPAuthtakesscopesand a fixedcallback_port, andMCPRegistry(http_client_factory=...)builds the HTTP client - authenticated proxy, OS trust store, mTLS - for both the MCP transport and every step of the OAuth flow. Cached tokens are kept per scope set, so changingscopesre-authorizes. (#234, from #188 by @OchnikBartek; closes #183)
- Subagents keep the parent's eviction settings. The default subagent factory
built every subagent with the default
- 0.3.462026-10-05 · 2026-10-05 23:49 UTC
查看更新说明
Fixed
- A fresh install of 0.3.45 failed on import.
pydantic-ai-backend0.2.32 importedhttpxfor every workspace without declaring it in theworkspacesextra, soimport pydantic_deepraisedModuleNotFoundError: No module named 'httpx'outside a development environment. The requirement is nowpydantic-ai-backend>=0.2.33, which declares it. create_deep_agent()needed a package it did not install. Web search is on by default with a DuckDuckGo fallback for models without a native search tool, and Pydantic AI now builds that fallback with the agent - so a plainpip install pydantic-deepraised "requires theduckduckgooptional group". Theduckduckgogroup is now part of the base requirement. A new CI job installs the package alone and builds the default agent.
- A fresh install of 0.3.45 failed on import.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Pydantic Deep Agents is two things in one repo:
🖥️ A terminal AI assistant — a self-hosted, open-source alternative to Claude Code. Install it, point it at any model, and it plans, edits files, runs commands, searches the web, remembers across sessions, spawns sub-agents, and connects to MCP servers. Almost everything Claude Code does — on the model you choose.
🐍 A Python framework — the exact same harness behind a single function call. create_deep_agent() hands a model a filesystem, shell, planning, memory, sub-agents, sandboxed execution, MCP, and unlimited context. Build your own assistant, research agent, or coding tool without rewiring the plumbing every time.
Both run on Pydantic AI, work with any model (Claude, GPT, Gemini, local), and are 100% type-safe and MIT-licensed — and they share one trick nothing else has: Live Run Forking, splitting a single run into parallel branches an AI judge merges back together.
Two ways to use it
🖥️ 1. Use the assistant
A Claude-Code-style TUI in your terminal, on any model — no Python setup (the script installs uv + the CLI for you):
curl -fsSL https://raw.githubusercontent.com/vstorm-co/pydantic-deepagents/main/install.sh | bash
pydantic-deep
Windows / manual:
pip install "pydantic-deep[cli]"
🐍 2. Build your own
One function call gives you a full deep agent:
pip install pydantic-deep
from pydantic_deep import create_deep_agent
agent = create_deep_agent(model="anthropic:claude-sonnet-4-6")
result = await agent.run("Build a REST API for auth")
⑂ Live Run Forking — the feature no one else has
Claude Code can't do this. Aider can't. LangGraph and CrewAI can't. It's the reason to use pydantic-deep.
When an agent hits a fork in the road — "should I refactor this with a decorator or a context manager?" — most tools force one bet. Pydantic Deep Agents lets the run branch:
┌── branch A: "use a decorator" ── tests: 8/8 ✓ conf 0.71
agent.run("refactor auth") ──┬─┼── branch B: "use a context manager" ── tests: 6/8 ✗ conf 0.42
(shared history) │ └── branch C: "extract a base class" ── tests: 8/8 ✓ conf 0.55
│
└──► ⚖️ AI judge weighs quality + tests + consistency
→ adopts branch A, continues the run
Each branch is fully isolated: a copy-on-write filesystem overlay (reads fall through to the parent, writes stay local), 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 the winning branch's history is adopted as the parent run's continuation.
Framework — opt in with one flag:
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
forking=True, # gives the agent: fork_run, inspect_branches,
) # merge_or_select, diff_branches, fork_cost, terminate_branch
Or run a real test command against every branch and let exit codes decide the winner:
from pydantic_deep import LiveForkCapability
agent = create_deep_agent(
forking=LiveForkCapability(test_command="pytest -q", test_timeout_s=120),
)
# confidence = quality_spread·0.4 + test_pass_ratio·0.4 + internal_consistency·0.2
CLI — fork an in-flight conversation, watch branches stream live, merge the best:
/fork # split the current run into N parallel branches
>>A try a decorator # steer branch A
>>B use a contextmgr # steer branch B
/merge # resolve — manual picker, AI judge, or vote
Live per-branch panels stream each approach side by side; a judge screen scores them; you accept, review the diff, or decline. Configure branch count, budgets, per-branch models, and merge strategy with /fork-config.
📖 Full reference: docs/capabilities/live-fork.md
🆚 Why pydantic-deep?
The only tool that is a terminal assistant and a Python framework and can fork its own runs — without giving up type safety or your choice of model.
| Pydantic Deep | Claude Code | Aider | LangGraph | CrewAI | |
|---|---|---|---|---|---|
| Terminal TUI assistant | ✅ | ✅ | ✅ | — | — |
| Python framework / library | ✅ | — | ~ | ✅ | ✅ |
| Live run forking + AI judge | ✅ | — | — | — | — |
| Multi-agent swarm + message bus | ✅ | ~ | — | ✅ | ✅ |
| Any model / any provider | ✅ | Anthropic | ✅ | ✅ | ✅ |
| Sandboxed Docker execution | ✅ | — | ~ | DIY | DIY |
| Persistent memory + skills | ✅ | ✅ | — | DIY | ~ |
| Type-safe structured output | ✅ | — | — | ~ | ~ |
| MCP servers | ✅ | ✅ | — | ~ | ~ |
| Self-hosted, open source | ✅ MIT | — | ✅ | ✅ | ✅ |
✅ first-class · ~ partial / via extensions · — not available · DIY you wire it yourself. Comparison reflects each project as of 2026-06; corrections welcome via PR.
What's New
- 2026-06-01 v0.3.24 — Live Run Forking — split an in-flight
agent.run()into N parallel branches with copy-on-write isolation, per-branch budgets, a test-runner hook, and four merge modes (manual/auto/auto_with_fallback/vote). Opt in withforking=True. - 2026-06-01 v0.3.23 — MCP client support (framework + CLI). Connect GitHub, Figma (OAuth), Context7, DeepWiki, or any custom server. Import servers straight from Claude Code. New interactive
/mcpcommand. Plus a full CLI presentation pass: clipboard image paste, real+/-diffs, tool icons, turn summaries. - 2026-06-01 v0.3.23 — Automatic fallback-model retry —
fallback_model=wraps your primary in aFallbackModelchain; fires on API errors but never on auth errors. Plus a batteries-included security hook preset (default_security_hook()) and three new output styles (markdown,json-only,bullet). - 2026-04-22 v0.3.17 — LiteParse document parsing (
include_liteparse=True) — PDFs, DOCX, XLSX, PPTX, and images with optional OCR, all local. - 2026-04-10 v0.3.5 — Headless runner (
pydantic-deep run), Docker sandbox with named workspaces, browser automation via Playwright.
Full history: CHANGELOG.md
The Agent Harness
Pydantic Deep Agents is an agent harness — the complete infrastructure that wraps an LLM and makes it a functional autonomous agent. The model provides intelligence; the harness provides planning, tools, memory, sandboxed execution, unlimited context, and — uniquely — the ability to fork.
Built natively on pydantic-ai — uses the Capabilities API directly, inherits all pydantic-ai streaming, multi-model support, and Pydantic validation automatically.
🖥️ CLI — Terminal AI Assistant
A Claude Code-style terminal AI assistant that works with any model and any provider — and forks.
Install (macOS & Linux)
curl -fsSL https://raw.githubusercontent.com/vstorm-co/pydantic-deepagents/main/install.sh | bash
No Python setup required — the script installs uv and the CLI automatically. Then:
export ANTHROPIC_API_KEY=sk-ant-...
pydantic-deep
Windows / manual:
pip install "pydantic-deep[cli]"· Update:pydantic-deep update
Model & Provider Support
Works with any model that supports tool-calling:
| Provider | Example models |
|---|---|
| Anthropic | anthropic:claude-opus-4-6, claude-sonnet-4-6 |
| OpenAI | openai:gpt-5.4, gpt-4.1 |
| OpenRouter | openrouter:anthropic/claude-opus-4-6 (200+ models) |
| Google Gemini | google-gla:gemini-2.5-pro |
| Ollama (local) | ollama:qwen3, ollama:llama3.3 |
| Any OpenAI-compatible | Custom base URL via env |
Switch model anytime: pydantic-deep config set model openai:gpt-5.4 or /model in the TUI.
What you get in the TUI
| Feature | |
|---|---|
| ⑂ | Live run forking — split a run into branches, stream them side by side, merge the winner |
| 💬 | Streaming chat with tool call visualization, icons, and real +/- diffs |
| 📁 | File read / write / edit, shell execution, glob, grep |
| 🤝 | Task planning, plan mode, and subagent delegation |
| 🧠 | Persistent memory and self-improvement across sessions |
| ♾️ | Context compression for unlimited conversations |
| 🔖 | Checkpoints — save, rewind, and fork any session |
| 🔌 | MCP servers via /mcp — GitHub, Figma (OAuth), and more; import from Claude Code |
| 🌐 | Web search & fetch built-in · 🖥️ browser automation via Playwright (--browser) |
| 🐳 | Docker sandbox — sandboxed execution with named workspaces |
| 💭 | Extended thinking — minimal / low / medium / high / xhigh |
| 📋 | Clipboard image paste (Ctrl+V / /paste) — multimodal prompts |
| 💰 | Real-time cost and token tracking per session |
| 🛡️ | Tool approval dialogs — approve, auto-approve, or deny per tool call |
| @ | @filename file references · !command shell passthrough |
| ✨ | /fork, /merge, /improve, /skills, /mcp, /model, /theme, /compact, and more |
Usage
# Interactive TUI (default)
pydantic-deep
pydantic-deep tui --model openrouter:anthropic/claude-opus-4-6
# Headless deep agent — benchmarks, CI/CD, scripted automation
pydantic-deep run "Fix the failing test in test_auth.py"
pydantic-deep run --task-file task.md --json
# Docker sandbox — sandboxed execution, project dir mounted at /workspace
pydantic-deep tui --sandbox docker
pydantic-deep tui --workspace ml-env # named workspace, packages persist
# Browser automation (requires pydantic-deep[browser])
pydantic-deep tui --browser
# Config & skills
pydantic-deep config set model anthropic:claude-sonnet-4-6
pydantic-deep skills list
pydantic-deep update # update to latest version
See CLI docs for the full reference.
🐍 Framework — Build Your Own Agent
pip install pydantic-deep
One function call gives you a production deep agent with planning, tool-calling, multi-agent delegation, persistent memory, unlimited context, forking, and cost tracking. Everything is a toggle:
from pydantic_deep import LocalWorkspace, create_deep_agent, create_default_deps
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
workspace=LocalWorkspace("."), # where it works: memory (default), disk, Docker, …
forking=True, # ⑂ split a run into parallel branches + AI judge
include_todo=True, # Task planning with subtasks and dependencies
include_subagents=True, # Multi-agent swarm — delegate to subagents
include_skills=True, # Domain-specific skills from SKILL.md files
include_memory=True, # Persistent memory across sessions
include_plan=True, # Structured planning before execution
include_teams=True, # Agent teams with shared TODO lists + message bus
include_liteparse=True, # Document parsing — PDF, DOCX, XLSX + OCR
web_search=True, # Tool-calling: web search
thinking="high", # Extended thinking / reasoning effort
context_manager=True, # Unlimited context via auto-summarization
cost_tracking=True, # Token/USD budget enforcement
fallback_model="openai:gpt-5.4", # auto-retry if the primary model fails
include_checkpoints=True, # Save, rewind, and fork conversations
)
deps = create_default_deps()
result = await agent.run("Build a REST API for user auth", deps=deps)
Structured Output
Type-safe responses with Pydantic models — no JSON parsing, no dict["key"]:
from pydantic import BaseModel
class CodeReview(BaseModel):
summary: str
issues: list[str]
score: int
agent = create_deep_agent(output_type=CodeReview)
result = await agent.run("Review the auth module", deps=deps)
print(result.output.score) # fully typed
Multi-Agent Swarm
Spawn isolated subagents for parallel workstreams. Each subagent is a full deep agent with its own tool-calling, memory, and context:
agent = create_deep_agent(
subagents=[
{
"name": "researcher",
"description": "Researches topics using web search",
"instructions": "Search the web, synthesize findings, cite sources.",
},
{
"name": "code-reviewer",
"description": "Reviews code for quality, security, and performance",
"instructions": "Check for security issues, N+1 queries, missing tests...",
},
],
)
# Main agent delegates: task(description="Review auth.py", subagent_type="code-reviewer")
Claude Code-Style Lifecycle Hooks + Security Preset
from pydantic_deep import create_deep_agent, default_security_hook, Hook, HookEvent
agent = create_deep_agent(
hooks=[
*default_security_hook(), # blocks destructive shell, path traversal, secret leaks
Hook(
event=HookEvent.PRE_TOOL_USE,
command="echo 'Tool: $TOOL_NAME args: $TOOL_INPUT' >> /tmp/audit.log",
),
],
)
MCP Servers
Connect GitHub, Figma (OAuth), Context7, DeepWiki, or any custom server — auth handled for you:
from pydantic_deep import create_deep_agent, build_mcp_server, MCPServerConfig
deepwiki = build_mcp_server(
MCPServerConfig(name="deepwiki", transport="http", url="https://mcp.deepwiki.com/mcp")
)
agent = create_deep_agent(mcp_servers=[deepwiki]) # curated defaults via builtin_mcp_servers()
Context Files
Pydantic Deep Agents auto-discovers and injects project-specific context into every conversation:
| File | Purpose | Who Sees It |
|---|---|---|
AGENTS.md | Project conventions, architecture, instructions | Main agent + all subagents |
CLAUDE.md | Claude Code project instructions | Main agent + all subagents |
SOUL.md | Agent personality, style, communication preferences | Main agent only |
.cursorrules | Cursor editor conventions | Main agent only |
MEMORY.md | Persistent memory — read/write/update tools | Per-agent (isolated) |
Compatible with Claude Code, Cursor, GitHub Copilot, and other agent frameworks. AGENTS.md follows the agents.md spec.
See the full API reference for all options.
🔬 DeepResearch — Reference App
A full-featured research deep agent with web UI — built entirely on Pydantic Deep Agents.
Web search (Tavily, Brave, Jina), sandboxed code execution, Excalidraw diagrams, plan mode, report export.
cd apps/deepresearch && uv sync && cp .env.example .env
uv run deepresearch # → http://localhost:8080
See apps/deepresearch/README.md for full setup.
Architecture
Pydantic Deep Agents uses pydantic-ai's native Capabilities API for all cross-cutting concerns — forking, hooks, memory, skills, context files, teams, and plan mode are all first-class pydantic-ai capabilities.
Pydantic Deep Agents
+---------------------------------------------------------------------+
| |
| +----------+ +----------+ +----------+ +----------+ +---------+ |
| | Planning | |Filesystem| | Subagents| | Skills | | Teams | |
| +----+-----+ +----+-----+ +----+-----+ +----+-----+ +----+----+ |
| | | | | | |
| +------------+-----+------+------------+------------+ |
| | |
| v |
| Forking --> +------------------+ <-- Capabilities |
| Summarization --> | Deep Agent | <-- Hooks |
| Checkpointing --> | (pydantic-ai) | <-- Memory |
| Cost Tracking --> | | <-- MCP |
| +--------+---------+ |
| | |
| +-----------------+-----------------+ |
| v v v |
| +------------+ +------------+ +------------+ |
| | State | | Local | | Docker | |
| | Workspace | | Workspace | | Workspace | |
| +------------+ +------------+ +------------+ |
| |
+---------------------------------------------------------------------+
Modular Packages
Every component is a standalone package — use only what you need:
| Package | What It Does |
|---|---|
| pydantic-ai-backend | Workspaces (Docker, sandboxd, Kubernetes, Daytona, in-memory) and the console toolset |
| pydantic-ai-todo | Task planning with subtasks and dependencies |
| subagents-pydantic-ai | Sync/async delegation, background tasks, cancellation |
| summarization-pydantic-ai | LLM summaries or zero-cost sliding window |
| pydantic-ai-shields | Cost tracking, input/output/tool blocking |
Full Feature List
Live Run Forking
- Split an in-flight
agent.run()into N parallel branches sharing history up to the fork point - Copy-on-write
BranchOverlayfilesystem isolation — reads fall through to parent, writes stay local - Per-branch steering messages, per-branch
budget_usdcaps, aggregate budget enforcement - Four merge modes:
manual,auto,auto_with_fallback(default),vote - Autonomous
JudgeAgentwith structuredJudgeVerdict;compute_confidenceblends quality, test pass ratio, and consistency - Test-runner hook — run a shell command against each branch's snapshot; exit code feeds the judge
- Agent tools:
fork_run,inspect_branches,merge_or_select,terminate_branch,diff_branches,fork_cost - CLI:
/fork,/merge,/fork-config, live per-branch streaming panels, judge screen, merge acceptance gate
Tool-Calling
ls,read_file,write_file,edit_file,glob,grep,execute— full filesystem access- Docker sandbox with named workspaces — sandboxed execution, packages persist between sessions
- Web search (DuckDuckGo, Tavily, Brave) and web fetch
- Browser automation via Playwright —
navigate,click,type_text,screenshot,execute_js, and more
Deep Agent Architecture
- Planning — Task tracking with subtasks, dependencies, and cycle detection
- Subagents / Multi-agent swarm — Sync/async delegation, background task management, soft/hard cancellation
- Agent Teams — Shared TODO lists with claiming and dependency tracking, peer-to-peer message bus
- Plan Mode — Dedicated planner subagent for structured planning before execution
- Persistent memory — MEMORY.md that persists across sessions, auto-injected into system prompt
- Self-improving —
/improveanalyzes past sessions, proposes updates to context files
Context & Memory
- Unlimited context — Auto-summarization when approaching token budget (LLM-based or sliding window)
- Context limit warnings — Model receives URGENT/CRITICAL messages when approaching 70% context usage
- Eviction capability — Intercepts large tool outputs via
after_tool_executebefore they enter history - Context files — Auto-discover AGENTS.md, CLAUDE.md, SOUL.md, .cursorrules, copilot-instructions, and more
- Checkpoints — Save state, rewind or fork conversations. In-memory and file-based stores
Production Features
- MCP — Connect any Model Context Protocol server; import from Claude Code; OAuth + keystore auth
- Lifecycle hooks — Claude Code-style PRE/POST_TOOL_USE. Shell commands or Python handlers
- Security preset —
default_security_hook()blocks destructive commands, path traversal, secret leaks - Fallback models —
fallback_model=chains; fires on API errors, never on auth errors - Structured output — Type-safe responses with Pydantic models via
output_type - Cost tracking — Token/USD budgets with automatic enforcement and real-time callbacks
- Output styles — Built-in (concise, explanatory, formal, conversational, markdown, json-only, bullet) or custom
- Streaming · Image support · Human-in-the-loop confirmation workflows
CLI
- Interactive TUI (Textual) with streaming, tool visualization, live fork panels, session management
- Headless runner (
pydantic-deep run) for CI/CD, benchmarks, scripted automation - 25+ slash commands:
/fork,/merge,/mcp,/improve,/compact,/diff,/model,/skills,/theme, and more @filenamefile references,!commandshell passthrough, clipboard image paste- Tool approval dialogs with auto-approve · debug logging per session
Contributing
git clone https://github.com/vstorm-co/pydantic-deepagents.git
cd pydantic-deepagents
make install
make test # 100% coverage required
make all # lint + typecheck + test
See CONTRIBUTING.md. Good first issues are labeled here.
Vstorm OSS Ecosystem
pydantic-deep is part of a broader open-source ecosystem for production AI agents:
| Project | Description | Stars |
|---|---|---|
| AgenticOS | Open-source (Apache-2.0), self-hosted platform to build, share and govern AI agents across a company. | |
| full-stack-ai-agent-template | Zero to production AI app in 30 minutes. FastAPI + Next.js 15, 5 AI frameworks (incl. Pydantic Deep Agents), RAG pipeline, 75+ config options. | |
| pydantic-ai-shields | Drop-in guardrails for Pydantic AI agents. 5 infra + 5 content shields. | |
| subagents-pydantic-ai | Declarative multi-agent orchestration with token tracking. | |
| summarization-pydantic-ai | Smart context compression for long-running agents. | |
| pydantic-ai-backend | Sandboxed execution for AI agents. Docker + Daytona. | |
| content-skills | Claude Code content studio — blog, social, slides, video, infographics — all brand-aware. | |
| production-stack-skills | Claude Code skills for production-grade FastAPI, PostgreSQL, Docker, and observability. |
Want the full stack? Use full-stack-ai-agent-template — it ships pydantic-deep integrated with FastAPI, Next.js, auth, WebSocket streaming, and RAG out of the box.
Browse all projects at github.com/vstorm-co
Star History
If pydantic-deep saved you from wiring an agent harness by hand — give it a ⭐. It's the single biggest thing that helps the project grow.
License
MIT — see LICENSE
Need help shipping AI agents in production?
Made with care by Vstorm