Metadata-Version: 2.4
Name: pai-agent-sdk
Version: 0.0.0
Summary: Production-ready SDK for building AI agents with Pydantic AI
Project-URL: Repository, https://github.com/youware-labs/pai-agent-sdk
Author-email: youware <lab@youware.com>
License-File: LICENSE
Keywords: python
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.14,>=3.11
Requires-Dist: agent-environment==0.1.0
Requires-Dist: anyio>=4.12.0
Requires-Dist: cdp-use<2.0.0,>=1.4.4
Requires-Dist: httpx>=0.28.1
Requires-Dist: jinja2>=3.0.0
Requires-Dist: pathspec>=0.12.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: pydantic-ai-slim>=1.41.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: pydantic>=2.12.5
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: tenacity>=9.0.0
Requires-Dist: typing-extensions>=4.15.0
Provides-Extra: all
Requires-Dist: docker>=7.0.0; extra == 'all'
Requires-Dist: firecrawl-py>=4.0.0; extra == 'all'
Requires-Dist: markitdown[all]>=0.1.2; extra == 'all'
Requires-Dist: pydantic-ai; extra == 'all'
Requires-Dist: pymupdf-layout>=1.26.6; extra == 'all'
Requires-Dist: pymupdf4llm>=0.2.8; extra == 'all'
Requires-Dist: pymupdf>=1.26.6; extra == 'all'
Requires-Dist: python-dotenv; extra == 'all'
Requires-Dist: tavily-python>=0.7.0; extra == 'all'
Provides-Extra: docker
Requires-Dist: docker>=7.0.0; extra == 'docker'
Provides-Extra: document
Requires-Dist: markitdown[all]>=0.1.2; extra == 'document'
Requires-Dist: pymupdf-layout>=1.26.6; extra == 'document'
Requires-Dist: pymupdf4llm>=0.2.8; extra == 'document'
Requires-Dist: pymupdf>=1.26.6; extra == 'document'
Provides-Extra: examples
Requires-Dist: pydantic-ai; extra == 'examples'
Requires-Dist: python-dotenv; extra == 'examples'
Provides-Extra: web
Requires-Dist: firecrawl-py>=4.0.0; extra == 'web'
Requires-Dist: markitdown[all]>=0.1.2; extra == 'web'
Requires-Dist: tavily-python>=0.7.0; extra == 'web'
Description-Content-Type: text/markdown

# pai-agent-sdk

[![Release](https://img.shields.io/github/v/release/youware-labs/pai-agent-sdk)](https://img.shields.io/github/v/release/youware-labs/pai-agent-sdk)
[![Build status](https://img.shields.io/github/actions/workflow/status/youware-labs/pai-agent-sdk/main.yml?branch=main)](https://github.com/youware-labs/pai-agent-sdk/actions/workflows/main.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/youware-labs/pai-agent-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/youware-labs/pai-agent-sdk)
[![Commit activity](https://img.shields.io/github/commit-activity/m/youware-labs/pai-agent-sdk)](https://img.shields.io/github/commit-activity/m/youware-labs/pai-agent-sdk)
[![License](https://img.shields.io/github/license/youware-labs/pai-agent-sdk)](https://img.shields.io/github/license/youware-labs/pai-agent-sdk)

Production-ready SDK for building AI agents with [Pydantic AI](https://ai.pydantic.dev/).

> **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](https://github.com/youware-labs/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

```bash
# 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

```python
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/](examples/) directory for production-ready patterns:

| Example                                     | Description                                                                        |
| ------------------------------------------- | ---------------------------------------------------------------------------------- |
| [general.py](examples/general.py)           | Complete production pattern with streaming, HITL approval, and session persistence |
| [deepresearch.py](examples/deepresearch.py) | Autonomous research agent with web search and content extraction                   |
| [browser_use.py](examples/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](SKILL.md) file in the repository root provides comprehensive guidance for agents
- **Download release package**: Get the latest `SKILL.zip` from the [Releases](https://github.com/youware-labs/pai-agent-sdk/releases) page (automatically built during each release)

## Configuration

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

## Documentation

- [AgentContext & Sessions](docs/context.md) - Session state, resumable sessions, extending context
- [Toolset Architecture](docs/toolset.md) - Create tools, use hooks, handle errors, extend Toolset
- [Subagent System](docs/subagent.md) - Hierarchical agents, builtin presets, markdown configuration
- [Custom Environments](docs/environment.md) - Environment lifecycle, resource management
- [Resumable Resources](docs/resumable-resources.md) - Export and restore resource states across restarts
- [Model Configuration](docs/model.md) - Provider setup, gateway mode
- [Logging Configuration](docs/logging.md) - Configure SDK logging levels

## Development

See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
