Skip to main content

Production-ready SDK for building AI agents with Pydantic AI

Project description

PAI Agent SDK

PAI is for Paintress or Pydantic AI

Release Build status codecov Commit activity License

Production-ready SDK for building AI agents with Pydantic AI. Used to build the next-generation Agent system and evaluation system of YouWare.

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)

Project Structure

This repository contains:

  • pai_agent_sdk/ - Core SDK for building AI agents with environment abstraction, toolsets, and session management
  • paintress_cli/ - Reference CLI implementation with TUI (Terminal User Interface) for interactive agent sessions
  • examples/ - Production-ready code examples demonstrating SDK features
  • docs/ - Comprehensive documentation for SDK architecture and APIs

Quick Start

Using the SDK

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)

Using Paintress CLI

For a ready-to-use terminal interface, try paintress-cli - a TUI reference implementation built on top of pai-agent-sdk:

# Run directly with uvx (no installation needed)
uvx paintress-cli

# Or install globally
uv tool install paintress-cli
pip install paintress-cli

Features:

  • Rich terminal UI with syntax highlighting and streaming output
  • Built-in tool approval workflows (human-in-the-loop)
  • Session management with conversation history
  • Browser automation support via Docker sandbox
  • MCP (Model Context Protocol) server integration

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.5.1.tar.gz (630.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.5.1-py3-none-any.whl (201.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pai_agent_sdk-0.5.1.tar.gz
Algorithm Hash digest
SHA256 462ec0ec36ec5c30bc378ff67c73fbe1540ecde47996260532145d2b4536b3bc
MD5 2eb0ee9cd0e0cda605528686c4819917
BLAKE2b-256 241f5047a3ffcf126151548310d2cb044b529e326e5ecbd9d6d9bdd4e31227a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pai_agent_sdk-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7af8a6067b24590cd48d9eeefe12dd2fdc96fd376bf1372989c358dbe361f625
MD5 84d23d6311a6e8615477c7ceed75ce79
BLAKE2b-256 0b0f28cb2447bfaf6e0a58e3d2c2bd8c0b4f4a6d432fe364206853b317d6a23d

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