- Python 3.10+
- uv (recommended) or pip
uv add pydantic-deeppip install pydantic-deeppydantic-deep offers several optional dependency groups:
| Extra | Description | Use Case |
|---|---|---|
sandbox |
Docker container support | Isolated code execution |
cli |
CLI tools (typer, rich) | Interactive terminal apps |
web |
Web server (FastAPI, uvicorn) | Web-based agent interfaces |
dev |
Development tools | Testing and documentation |
all |
All optional dependencies | Everything |
For isolated code execution in Docker containers:
uv add pydantic-deep[sandbox]
# or
pip install pydantic-deep[sandbox]!!! tip "Standalone Usage"
Backends are also available separately as pydantic-ai-backend for use with any pydantic-ai agent.
For building interactive terminal applications:
uv add pydantic-deep[cli]
# or
pip install pydantic-deep[cli]Includes: typer, rich, prompt-toolkit
For web-based agent interfaces:
uv add pydantic-deep[web]
# or
pip install pydantic-deep[web]Includes: FastAPI, uvicorn
Install everything:
uv add pydantic-deep[all]
# or
pip install pydantic-deep[all]For running tests and building documentation:
uv add pydantic-deep[dev]
# or
pip install pydantic-deep[dev]pydantic-deep uses Pydantic AI which supports multiple model providers. Set your API key:
=== "Anthropic"
```bash
export ANTHROPIC_API_KEY=your-api-key
```
=== "OpenAI"
```bash
export OPENAI_API_KEY=your-api-key
```
=== "Google"
```bash
export GOOGLE_API_KEY=your-api-key
```
For using DockerSandbox:
- Install Docker: Get Docker
- Ensure Docker daemon is running
- Pull the Python image:
docker pull python:3.12-slimimport asyncio
from pydantic_deep import create_deep_agent, DeepAgentDeps, StateBackend
async def main():
agent = create_deep_agent()
deps = DeepAgentDeps(backend=StateBackend())
result = await agent.run("Say hello!", deps=deps)
print(result.output)
asyncio.run(main())If you get import errors, ensure you have the correct Python version:
python --version # Should be 3.10+Make sure your API key is set in the environment:
echo $ANTHROPIC_API_KEYOn Linux, you may need to add your user to the docker group:
sudo usermod -aG docker $USERThen log out and back in.
- Core Concepts - Learn the fundamentals
- Basic Usage Example - Your first deep agent
- API Reference - Complete API documentation