Skip to content

Installation

Requirements

  • Python 3.10+
  • uv (recommended) or pip
uv add pydantic-deep

Install with pip

pip install pydantic-deep

Optional Dependencies

Docker Sandbox

For isolated code execution in Docker containers:

uv add pydantic-deep[sandbox]
# or
pip install pydantic-deep[sandbox]

Development

For running tests and building documentation:

uv add pydantic-deep[dev]
# or
pip install pydantic-deep[dev]

Environment Setup

API Key

pydantic-deep uses Pydantic AI which supports multiple model providers. Set your API key:

export ANTHROPIC_API_KEY=your-api-key
export OPENAI_API_KEY=your-api-key
export GOOGLE_API_KEY=your-api-key

Docker (optional)

For using DockerSandbox:

  1. Install Docker: Get Docker
  2. Ensure Docker daemon is running
  3. Pull the Python image:
docker pull python:3.12-slim

Verify Installation

import 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())

Troubleshooting

Import Errors

If you get import errors, ensure you have the correct Python version:

python --version  # Should be 3.10+

API Key Not Found

Make sure your API key is set in the environment:

echo $ANTHROPIC_API_KEY

Docker Permission Denied

On Linux, you may need to add your user to the docker group:

sudo usermod -aG docker $USER

Then log out and back in.

Next Steps