Deep Agent framework built on Pydantic-ai with planning, filesystem, and subagent capabilities
Project description
Pydantic AI Deep Agents Framework
Build Claude Code-Style AI Agents — In 10 Lines of Python
🔄 Unlimited Context via summarization • 🤖 Subagent Delegation sync & async • 🧩 Modular use only what you need • 🎯 Fully Type-Safe
See It In Action
Get Started in 60 Seconds
pip install pydantic-deep
from pydantic_ai_backends import StateBackend
from pydantic_deep import create_deep_agent, create_default_deps
agent = create_deep_agent()
deps = create_default_deps(StateBackend())
result = await agent.run("Create a todo list for building a REST API", deps=deps)
That's it. Your agent can now:
- ✅ Plan tasks — break down complex work into steps
- ✅ Read & write files — navigate and modify codebases
- ✅ Delegate to subagents — spawn specialists for specific tasks
- ✅ Load skills — use domain-specific instructions
- ✅ Manage context — handle unlimited conversation length
Same Architecture as the Best
pydantic-deep implements the deep agent architecture — the same patterns powering:
| Product | What They Built | |
|---|---|---|
| 🤖 | Claude Code | Anthropic's AI coding assistant |
| 🦾 | Manus AI | Autonomous task execution |
| 👨💻 | Devin | AI software engineer |
Now you can build the same thing.
Inspired by: This framework is also inspired by LangChain's Deep Agents research on autonomous agent architectures.
Features
🧠 Planning — pydantic-ai-todo
Task tracking with
read_todos/write_todos. Subtasks & dependencies with cycle detection. PostgreSQL storage. Event system for webhooks.
📁 Filesystem — pydantic-ai-backend
Full access:
ls,read_file,write_file,edit_file,glob,grep,execute. Docker sandbox for isolation. Permission system (allow/deny/ask). Session manager for multi-user apps.
🤖 Subagents — subagents-pydantic-ai
Delegate with
taskin sync or async mode. Background task management. Dynamic agent creation at runtime. Soft/hard cancellation.
💬 Summarization — summarization-pydantic-ai
Two modes: LLM-based intelligent summaries or zero-cost sliding window. Trigger on tokens, messages, or context fraction. Custom prompts.
🎯 Skills — Load domain instructions from markdown files with YAML frontmatter.
📊 Structured Output — Type-safe responses with Pydantic models via output_type.
👤 Human-in-the-Loop — Built-in confirmation workflows for sensitive operations.
⚡ Streaming — Full streaming support for real-time responses.
Use Cases
| What You Want to Build | Key Components |
|---|---|
| AI Coding Assistant | Planning + Filesystem + Skills |
| Data Analysis Agent | File Uploads + Structured Output |
| Document Processor | Filesystem + Summarization |
| Research Agent | Subagents + Planning |
| Project Scaffolder | Planning + Filesystem |
| Test Generator | Filesystem + Docker Sandbox |
Modular — Use What You Need
Every component works standalone:
| Component | Package | Use It For |
|---|---|---|
| Backends | pydantic-ai-backend | File storage, Docker sandbox |
| Planning | pydantic-ai-todo | Task tracking |
| Subagents | subagents-pydantic-ai | Task delegation |
| Summarization | summarization-pydantic-ai | Context management |
Full-stack template? fastapi-fullstack — Production-ready with FastAPI + Next.js
Go Deeper
Structured Output
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) # Type-safe!
File Uploads
from pydantic_deep import run_with_files
with open("data.csv", "rb") as f:
result = await run_with_files(
agent,
"Analyze this data and find trends",
deps,
files=[("data.csv", f.read())],
)
Context Management
from pydantic_deep import create_summarization_processor
processor = create_summarization_processor(
trigger=("tokens", 100000),
keep=("messages", 20),
)
agent = create_deep_agent(history_processors=[processor])
Custom Subagents
agent = create_deep_agent(
subagents=[
{
"name": "code-reviewer",
"description": "Reviews code for quality issues",
"instructions": "You are a senior code reviewer...",
"preferred_mode": "sync",
},
],
)
Skills
Create ~/.pydantic-deep/skills/review/SKILL.md:
---
name: code-review
description: Review Python code for quality
---
# Code Review Skill
Check for:
- [ ] Security issues
- [ ] Type hints
- [ ] Error handling
agent = create_deep_agent(
skill_directories=[{"path": "~/.pydantic-deep/skills", "recursive": True}],
)
Architecture
pydantic-deep
┌──────────────────────────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Planning │ │Filesystem│ │ Subagents│ │ Skills │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ │ │ │ │
│ └────────────┴─────┬──────┴────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────┐ │
│ Summarization ──► │ Deep Agent │ │
│ │ (pydantic-ai) │ │
│ └────────┬─────────┘ │
│ │ │
│ ┌─────────────────┼─────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ State │ │ Local │ │ Docker │ │
│ │ Backend │ │ Backend │ │ Sandbox │ │
│ └────────────┘ └────────────┘ └────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────┘
Related Projects
- pydantic-ai - The foundation: Agent framework by Pydantic
- pydantic-ai-backend - File storage and sandbox backends
- pydantic-ai-todo - Task planning toolset
- subagents-pydantic-ai - Multi-agent orchestration
- summarization-pydantic-ai - Context management
- fastapi-fullstack - Full-stack AI app template
- deepagents - Deep Agent implementation by LangChain (inspiration)
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 for full guidelines.
Star History
License
MIT — see LICENSE
Built with ❤️ by vstorm-co
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_deep-0.2.16.tar.gz.
File metadata
- Download URL: pydantic_deep-0.2.16.tar.gz
- Upload date:
- Size: 375.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8de20aecbf140f6273c309e01b7ea795168ac81313e826616d7b69bcb3926b0b
|
|
| MD5 |
318c15fc09dcebbe8be711c1a68a38fb
|
|
| BLAKE2b-256 |
74291f945bffa67264be2b212ca69337f51da77d44a4ad78f9cc4d95f7c9a921
|
Provenance
The following attestation bundles were made for pydantic_deep-0.2.16.tar.gz:
Publisher:
publish.yml on vstorm-co/pydantic-deepagents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_deep-0.2.16.tar.gz -
Subject digest:
8de20aecbf140f6273c309e01b7ea795168ac81313e826616d7b69bcb3926b0b - Sigstore transparency entry: 946304323
- Sigstore integration time:
-
Permalink:
vstorm-co/pydantic-deepagents@5f29b783a9df15ac73aa37228c3f9da87b54f2fe -
Branch / Tag:
refs/tags/0.2.16 - Owner: https://github.com/vstorm-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f29b783a9df15ac73aa37228c3f9da87b54f2fe -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydantic_deep-0.2.16-py3-none-any.whl.
File metadata
- Download URL: pydantic_deep-0.2.16-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5aea154f1800c1da66e2b58230227b23299f139f9581f5585d2239b155a158c
|
|
| MD5 |
4f4c18e68cee32d7b63baf381242ed33
|
|
| BLAKE2b-256 |
54d6b3a9564048ab3c4a17cda5ff2772a3830e207bc24c049bb7f90fab671e1e
|
Provenance
The following attestation bundles were made for pydantic_deep-0.2.16-py3-none-any.whl:
Publisher:
publish.yml on vstorm-co/pydantic-deepagents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_deep-0.2.16-py3-none-any.whl -
Subject digest:
a5aea154f1800c1da66e2b58230227b23299f139f9581f5585d2239b155a158c - Sigstore transparency entry: 946304354
- Sigstore integration time:
-
Permalink:
vstorm-co/pydantic-deepagents@5f29b783a9df15ac73aa37228c3f9da87b54f2fe -
Branch / Tag:
refs/tags/0.2.16 - Owner: https://github.com/vstorm-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f29b783a9df15ac73aa37228c3f9da87b54f2fe -
Trigger Event:
release
-
Statement type: