Skip to content
Open Source Framework

Build Autonomous AI Agents
That Actually Ship

Production-grade Python framework implementing the deep agent pattern — agents that plan, code, execute, and delegate like Claude Code.

Terminal

Why use this?

Without DeepAgents

  • Fragile chains that break on unexpected inputs
  • No type safety — dict-based, error-prone
  • Hard to debug agent decision paths
  • Manual context window management
  • No subagent delegation pattern

With DeepAgents

  • Modular agents with structured planning
  • Fully type-safe with Pydantic models
  • Complete observability via Logfire
  • Automatic context summarization
  • Built-in subagent delegation and communication

Get Started in 4 Steps

From pip install to autonomous agents in minutes

1

Install

pip install pydantic-deepagents — one package, zero config, all batteries included.

2

Define Your Agent

Describe what your agent does with typed tools, system prompts, and optional sub-agents.

3

Run

Your agent plans, executes, and delegates — streaming results in real time via WebSocket.

4

Scale with Sub-Agents

Break complex tasks into specialized sub-agents that collaborate autonomously.

Everything an agent needs

From planning to deployment, the complete deep agent toolkit.

Deep Agent Pattern

Implements the Claude Code architecture — agents that reason, plan, and execute multi-step tasks autonomously.

Unlimited Context

Built-in conversation compaction lets agents work on tasks that exceed any model's context window.

Sub-agent Delegation

Spawn specialized sub-agents for parallel research, code generation, or analysis — then merge results.

Persistent Memory

Agents remember across sessions. Project-scoped and global memory with automatic relevance filtering.

Rich Tool System

Filesystem access, shell execution, web search, and custom tools — all with type-safe Pydantic models.

Production-Grade

Streaming, checkpoints, multi-provider support, Logfire integration, and battle-tested in 30+ deployments.

How does it compare?

See how it stacks up against alternatives.

Feature DeepAgents LangChain CrewAI AutoGen
Type Safety
Subagent Delegation
Tool System
Multi-Provider Partial
Observability Partial
Production Tested

How it works

A layered architecture from your application down to the LLM.

Your Application
DeepAgent Orchestrator
Planning
Engine
Memory
Manager
Context
Compactor
Middleware Stack
Guardrails Cost Tracking Logging Permissions
Tool Registry
Filesystem Shell Web Search Sub-agents Custom
LLM Provider
ClaudeOpenAIGemini

Three lines to your first agent

From basic setup to custom tools and sub-agent delegation.

agent.py
from pydantic_deep import create_deep_agent, DeepAgentDeps, StateBackend
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-20250514",
instructions="You are a senior Python developer.",
)
deps = DeepAgentDeps(backend=StateBackend())
result = await agent.run(
"Refactor the auth module to use JWT tokens",
deps=deps,
)

Built for real work

From code generation to research pipelines.

Code Generation & Refactoring

Autonomous agents that read codebases, plan changes, and implement them across multiple files.

  • Multi-file refactoring
  • Automated code review
  • Test generation
  • Dependency updates

Research Agents

Agents that search the web, analyze findings, and produce structured research reports.

  • Web search & scraping
  • Source cross-referencing
  • Structured output
  • Citation tracking

Data Pipeline Automation

Build, monitor, and fix data pipelines with agents that understand your infrastructure.

  • Pipeline scaffolding
  • Error diagnosis
  • Schema migrations
  • Performance tuning

CLI & DeepResearch

Interactive terminal, editor integration, and autonomous research — all included.

Interactive CLI

A full-featured terminal interface built with Textual. Resume conversations, switch models, track token usage — or plug into Zed via ACP.

  • Session resume & persistent memory
  • Multi-provider model switching
  • Custom skills & web search
  • Zed editor integration via ACP

DeepResearch

Autonomous research agent that plans queries, delegates to sub-agents, cross-references sources, and writes structured reports with citations.

  • Multi-step research planning
  • Parallel sub-agent delegation
  • Web search with full page fetching
  • Structured reports with citations

Frequently Asked Questions

Answers to common questions about the Full-Stack AI Agent Template, Pydantic DeepAgents, and Logfire integration. Find guides and troubleshooting tips.

What is pydantic-deep?
A Python framework for building autonomous AI agents inspired by Claude Code's architecture. It implements the deep agent pattern — agents that can plan, read/write files, delegate to subagents, and maintain persistent memory across sessions. Built on Pydantic AI, it provides type-safe tool definitions, structured outputs, and Logfire observability out of the box.
How does it differ from LangChain or CrewAI?
DeepAgents is type-safe by default (Pydantic models, not dicts), modular (compose tools, not chains), and observable (Logfire integration). It focuses on the deep agent pattern — long-running agents that plan and execute autonomously — rather than simple chain-of-thought or multi-agent chat. A comparable LangChain agent typically requires 3-5x more boilerplate code for the same functionality.
Which LLM providers are supported?
Any provider supported by Pydantic AI — OpenAI, Anthropic, Google Gemini, Groq, Mistral, and any OpenAI-compatible API (like Ollama for local models). Swap providers with one line of configuration. That means 6+ cloud providers and unlimited local models via Ollama, all with the same agent code and zero changes to your tool definitions.
Can I use my own tools?
Yes. Define tools using the @tool decorator from Pydantic AI. Tools are type-checked at runtime, support async execution, and integrate with the human-in-the-loop permission system. You can also use pre-built toolsets (filesystem, database, console) from companion libraries. Each tool is a plain Python function — no special SDK or wrapper needed beyond the decorator.
Is it production-ready?
Yes. DeepAgents powers 30+ production deployments at Vstorm. It includes structured logging via Logfire, automatic error recovery with configurable retry policies, and token usage tracking per agent run. The framework has been battle-tested in real-world AI agent applications handling thousands of autonomous tasks.

Frequently Asked Questions

What is Pydantic DeepAgents?

Production-grade Python framework for building autonomous AI agents on top of Pydantic AI. Implements the deep agent pattern: planning, filesystem ops, sandboxed execution, subagent delegation, context compression, and human-in-the-loop.

How is it different from LangChain Deep Agents?

Built on Pydantic AI (not LangGraph), full type safety, modular architecture with independently usable packages. Same capabilities but with Pydantic's developer experience.

Does it support human-in-the-loop?

Yes, via Pydantic AI's DeferredToolRequests. Tools can require approval before execution, with configurable permission presets (DEFAULT, PERMISSIVE, READONLY, STRICT).

Can agents delegate to sub-agents?

Yes, the subagents package supports sync, async, and auto-mode delegation with background task management, cancellation, and inter-agent messaging.

What models does it support?

Any model supported by Pydantic AI: OpenAI, Anthropic, Google Gemini, Mistral, Ollama (local), and more via OpenRouter.

Ready to build agents that actually think?

Install pydantic-deep, define your agent, and let it plan, code, and delegate — just like Claude Code, but yours.