Skip to main content

Production-ready SDK for building AI agents with Pydantic AI

Project description

pai-agent-sdk

Release Build status codecov Commit activity License

Production-ready SDK for building AI agents with Pydantic AI.

Early Stage Warning: This project is in active development. APIs may change frequently between versions. We welcome feedback and contributions to help stabilize the SDK.

Key Features

  • Environment-based Architecture: Inject file operations, shell access, and resumable resources via Environment for clean separation of concerns(check agent-environment)
  • Resumable Sessions: Export and restore AgentContext state for multi-turn conversations across restarts
  • Hierarchical Agents: Delegate specialized tasks to subagents with automatic tool inheritance
  • Human-in-the-Loop: Built-in approval workflows for sensitive tool operations
  • Streaming Support: Real-time streaming of agent responses and tool executions

Installation

# Recommended: install with all optional dependencies
pip install pai-agent-sdk[all]
uv add pai-agent-sdk[all]

# Or install individual extras as needed
pip install pai-agent-sdk[docker]    # Docker sandbox support
pip install pai-agent-sdk[web]       # Web tools (tavily, firecrawl, markitdown)
pip install pai-agent-sdk[document]  # Document processing (pymupdf, markitdown)

Quick Start

from pai_agent_sdk.agents import create_agent, stream_agent

# create_agent returns AgentRuntime (not a context manager)
runtime = create_agent("openai:gpt-4o")

# stream_agent manages runtime lifecycle automatically
async with stream_agent(runtime, "Hello") as streamer:
    async for event in streamer:
        print(event)

Examples

Check out the examples/ directory for production-ready patterns:

Example Description
general.py Complete production pattern with streaming, HITL approval, and session persistence
deepresearch.py Autonomous research agent with web search and content extraction
browser_use.py Browser automation with Docker-based headless Chrome sandbox

For Agent Users

If you're using an AI agent (e.g., Claude, Cursor) that supports skills:

  • Clone this repo: The SKILL.md file in the repository root provides comprehensive guidance for agents
  • Download release package: Get the latest SKILL.zip from the Releases page (automatically built during each release)

Configuration

Copy examples/.env.example to examples/.env and configure your API keys.

Documentation

Development

See CONTRIBUTING.md for development setup and guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pai_agent_sdk-0.0.0.tar.gz (493.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pai_agent_sdk-0.0.0-py3-none-any.whl (193.4 kB view details)

Uploaded Python 3

File details

Details for the file pai_agent_sdk-0.0.0.tar.gz.

File metadata

  • Download URL: pai_agent_sdk-0.0.0.tar.gz
  • Upload date:
  • Size: 493.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for pai_agent_sdk-0.0.0.tar.gz
Algorithm Hash digest
SHA256 8fe36cd29b770897594c004f4271d71310111ff5ceaaed4296ade3c3a648c7db
MD5 0ce8aa38d4c778e4d58fe15cc4abfaec
BLAKE2b-256 8ee12e57eb289c7e798eef2568151186da347ebd0686a65a2b38f85f999aa8d3

See more details on using hashes here.

File details

Details for the file pai_agent_sdk-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pai_agent_sdk-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfa69c0f9771f40fc4fef279bd711b65871c1b5f43e5a4e068cd0ccb1a35bcee
MD5 aa1519fcb2f98faaef8bfcf90cce2225
BLAKE2b-256 23187902c17e929978e3f3ee7073abd939b5e32b015764d0188da7b786ef8ea2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page