Pydantic AI integration for PathCourse Health — typed agents with autonomous USDC billing on Base L2
Project description
pydantic-ai-pathcourse
Pydantic AI integration for PathCourse Health. Build typed, production-grade agents with autonomous USDC billing on Base L2 — no accounts, no credit cards, no KYC.
Install
pip install pydantic-ai-pathcourse
Quick Start
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:
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
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.
export PCH_API_KEY=pch_prod_b_...
Get an API key at pathcoursehealth.com.
Links
- Platform: pathcoursehealth.com
- Pydantic AI: ai.pydantic.dev
- Python SDK: pypi.org/project/pathcourse-sdk
- Integration examples: github.com/pathcourse-health/pch-integration-examples
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_ai_pathcourse-0.1.0.tar.gz.
File metadata
- Download URL: pydantic_ai_pathcourse-0.1.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ceb501bee0b7dbd38006deb1076ecfd233e8d93782b7f16b945e289338050f3
|
|
| MD5 |
9c3b6af85dd7ac6d399e2d2c8bb56050
|
|
| BLAKE2b-256 |
0c7f78f72550e4c8235b33d44ec73c5625f677254fcb33eab0fa6a2f5fbb2827
|
File details
Details for the file pydantic_ai_pathcourse-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_pathcourse-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fef684531ef4bd5d688bbc0168f7eb40960abb8812fe1f3fa4bb282d40d12da
|
|
| MD5 |
d98835fafed2b95720ad3dad8e77730d
|
|
| BLAKE2b-256 |
bcbee232887cfa142539bdff4fbc981acfc9dd93ea4ece8ce202921881d478cf
|