Metadata-Version: 2.4
Name: pydantic-ai-pathcourse
Version: 0.1.0
Summary: Pydantic AI integration for PathCourse Health — typed agents with autonomous USDC billing on Base L2
Project-URL: Homepage, https://pathcoursehealth.com
Project-URL: Repository, https://github.com/pathcourse-health/pydantic-ai-pathcourse
Project-URL: Documentation, https://docs.pathcoursehealth.com
License: MIT
Keywords: ai-agents,autonomous,llm,pathcourse,pydantic-ai,typed-agents
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: openai>=1.40.0
Requires-Dist: pydantic-ai>=0.0.13
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: python-dotenv; extra == 'dev'
Description-Content-Type: text/markdown

# pydantic-ai-pathcourse

[Pydantic AI](https://ai.pydantic.dev) integration for PathCourse Health. Build typed,
production-grade agents with autonomous USDC billing on Base L2 — no accounts, no credit
cards, no KYC.

## Install

```bash
pip install pydantic-ai-pathcourse
```

## Quick Start

```python
from pydantic_ai import Agent
from pydantic_ai_pathcourse import PathCourseModel

agent = Agent(
    model=PathCourseModel("pch-pro"),
    system_prompt="You are an expert in autonomous agent infrastructure.",
)

result = agent.run_sync("What is Path Score?")
print(result.data)
```

## Structured output

Pydantic AI's structured-output guarantees work unchanged with PCH:

```python
from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai_pathcourse import PathCourseModel


class InfraReport(BaseModel):
    summary: str
    requirements: list[str]
    risk_level: int


agent = Agent(
    model=PathCourseModel("pch-pro"),
    result_type=InfraReport,
)

result = agent.run_sync("Analyze autonomous agent infrastructure for a fintech startup.")
print(result.data.requirements)
```

## Tool use

```python
from pydantic_ai import Agent, RunContext
from pydantic_ai_pathcourse import PathCourseModel

agent = Agent(model=PathCourseModel("pch-pro"))

@agent.tool
async def get_balance(ctx: RunContext[None], agent_id: str) -> float:
    """Look up the USDC balance for a PCH agent."""
    return 42.50

result = agent.run_sync("What is the balance for agent abc123?")
```

## Models

| Model | Rate | Notes |
|---|---|---|
| `pch-fast` | $0.44/M tokens | Fast reasoning, classification, routing |
| `pch-pro` | $1.96/M tokens | Deep reasoning, multi-step planning (Bronze+) |
| `pch-coder` | $3.50/M tokens | Code generation, debugging |
| `claude-haiku` | Common rate | Third-party balanced model (Silver+) |
| `claude-sonnet` | Common rate | Third-party long-context model (Gold) |

Choosing a model:

- Fast response, simple task → `pch-fast`
- Complex reasoning, multi-step → `pch-pro`
- Writing or reviewing code → `pch-coder`

## Authentication

Set `PCH_API_KEY` in your environment, or pass `pch_api_key=` to `PathCourseModel`.

```bash
export PCH_API_KEY=pch_prod_b_...
```

Get an API key at [pathcoursehealth.com](https://pathcoursehealth.com).

## Links

- Platform: [pathcoursehealth.com](https://pathcoursehealth.com)
- Pydantic AI: [ai.pydantic.dev](https://ai.pydantic.dev)
- Python SDK: [pypi.org/project/pathcourse-sdk](https://pypi.org/project/pathcourse-sdk/)
- Integration examples: [github.com/pathcourse-health/pch-integration-examples](https://github.com/pathcourse-health/pch-integration-examples)

## License

MIT
