█

AI/TLDR

Buy me a coffee
Buy me a coffee

Pydantic Deep Agents

A self-hosted terminal coding assistant and the Pydantic AI framework behind it

Autonomous Coding AgentsOpen source
Language
Python
License
MIT
IN SHORT

What is Pydantic Deep Agents?

Pydantic Deep Agents (the `pydantic-deep` package) is two things in one repository from the Vstorm team: a self-hosted terminal AI assistant in the style of Claude Code, and the Python framework that powers it. It sits in the Autonomous Coding Agents category of the AI Coding tools and is open-source, written in Python and licensed MIT.

Overview

Pydantic Deep Agents (the `pydantic-deep` package) is two things in one repository from the Vstorm team: a self-hosted terminal AI assistant in the style of Claude Code, and the Python framework that powers it. The assistant plans, edits files, runs shell commands, searches the web, remembers across sessions, spawns sub-agents and connects to MCP servers, on whichever tool-calling model you point it at — Anthropic, OpenAI, OpenRouter, Google Gemini, local Ollama models or any OpenAI-compatible endpoint.

The framework exposes the same harness behind one function call. `create_deep_agent()` hands a model a filesystem, a shell, task planning, persistent memory, sub-agents, sandboxed execution, MCP and automatic context summarisation, with each capability switched on by a flag. It is built natively on Pydantic AI's Capabilities API, so responses can be typed Pydantic models, and the README states the codebase is checked with Pyright and MyPy in strict mode.

Its headline feature is Live Run Forking: an in-flight run can split into several isolated branches, each on a copy-on-write filesystem overlay with its own steering message and dollar budget, and an AI judge, a test command or a vote picks the branch the run continues from. The repository also ships DeepResearch, a reference web app built on the framework that shows planning, parallel sub-agents and a workspace file browser.

What it does

  • Claude Code-style terminal UI with streaming tool calls, real diffs, tool approval dialogs and 25+ slash commands
  • Works with any tool-calling model: Anthropic, OpenAI, OpenRouter, Google Gemini, Ollama or an OpenAI-compatible URL
  • `create_deep_agent()` framework with planning, sub-agents, agent teams, skills, memory and checkpoints as toggles
  • Live Run Forking: parallel copy-on-write branches merged by an AI judge, test results or a vote
  • Docker sandbox with named workspaces, browser automation via Playwright, and MCP server support
  • Lifecycle hooks with a default security preset, fallback models, and token and USD budget tracking

Getting started

Pick the path you need from the README: run the terminal assistant, or install the library and build your own agent.

Install the terminal assistant

On macOS and Linux the install script sets up uv and the CLI with no Python setup. On Windows or for a manual install use `pip install "pydantic-deep[cli]"`.

bashbash
curl -fsSL https://raw.githubusercontent.com/vstorm-co/pydantic-deep/main/install.sh | bash

Set a key and start it

Export a provider key and launch the TUI. Switch models with `/model` inside the TUI or with the config command.

bashbash
export ANTHROPIC_API_KEY=sk-ant-...
pydantic-deep

# pick another model
pydantic-deep config set model openai:gpt-5.4
The pydantic-deep terminal UI writing a FastAPI demo app, with file writes, a summary and a status bar showing model, tokens and cost
The pydantic-deep TUI building a small FastAPI app, with the model, token count and cost in the status bar.Pydantic Deep Agents README ↗

Run headless or in a sandbox

The same CLI runs a task without the TUI for CI and scripts, or inside a Docker sandbox with your project mounted at /workspace.

bashbash
pydantic-deep run "Fix the failing test in test_auth.py"
pydantic-deep run --task-file task.md --json

pydantic-deep tui --sandbox docker
pydantic-deep tui --workspace ml-env

Build your own agent with the framework

Install the library and create an agent with one call; capabilities such as forking, sub-agents, memory and cost tracking are switched on by flags.

bashbash
pip install pydantic-deep

Create and run a deep agent

A minimal agent from the README, with a state backend for its files.

pythonpython
from pydantic_ai_backends import StateBackend
from pydantic_deep import create_deep_agent, create_default_deps

agent = create_deep_agent(
    model="anthropic:claude-sonnet-4-6",
    include_todo=True,
    include_subagents=True,
    include_memory=True,
    cost_tracking=True,
)

deps = create_default_deps(StateBackend())
result = await agent.run("Build a REST API for user auth", deps=deps)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Running a Claude Code-style coding assistant in the terminal on a model you choose, including local Ollama models
  • Scripting coding tasks in CI with the headless `pydantic-deep run` command
  • Building a custom research or coding agent in Python without rewiring planning, memory, sandboxing and sub-agents
DeepResearch web app where a planner sub-agent asks the user to choose the level of detail for a research task
Plan mode in the DeepResearch reference app: the planner sub-agent asks a clarifying question first.
DeepResearch web app showing five general-purpose sub-agents that each completed a research subtask, with a task progress bar
Five sub-agents researching in parallel, each saving notes to the workspace.
DeepResearch web app with a workspace file browser listing notes and a markdown file preview beside the agent's edit_file calls
The workspace file browser with an inline preview of a note the agents wrote.
  • Trying several approaches to one change in parallel and letting tests or an AI judge pick the winner

How Pydantic Deep Agents compares

Pydantic Deep Agents alongside other open-source autonomous coding agents tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
opencode★ 230kOpenCode is an open source AI coding agent that runs in your terminal, with built-in build and plan agents and an optional desktop app.
Claude Code★ 158kAnthropic's agentic coding tool for the terminal, IDE and GitHub: it understands your codebase, executes routine tasks, explains code and handles git workflows from natural-language commands.
Orca★ 147kOpen-source desktop workspace that runs Claude Code, Codex, OpenCode and other CLI coding agents in parallel, each in its own git worktree, with a mobile companion app.
OpenAI Codex★ 137kOpenAI's cloud and CLI coding agent that writes features, fixes bugs, and proposes code changes across a repo, running tasks in parallel.
Pi★ 125kMinimal terminal coding agent harness with four built-in tools, extended through TypeScript extensions, skills and prompt templates instead of forks.
Gemini CLI★ 109kAn open-source command-line AI agent from Google that connects your terminal to Gemini models for reading code, editing files, running shell commands, and searching the web.
autoresearch★ 101kKarpathy's minimal harness that hands a coding agent a single-GPU LLM training script and lets it run fixed five-minute experiments, keeping or discarding each change on its own.
Pydantic Deep Agents★ 1.1kA self-hosted terminal coding assistant and the Pydantic AI framework behind it