Skip to main content

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 Min tier Notes
pch-fast $0.44 / M tokens uncertified Fast reasoning, classification, routing
pch-coder $3.50 / M tokens uncertified Code generation, debugging
pch-embed $0.015 / M tokens uncertified Text embeddings for semantic search / RAG
pch-translate $0.08 / M chars uncertified Multilingual translation
pch-pro $1.96 / M tokens bronze Deep reasoning, multi-step planning
pch-audio $1.85 / M chars bronze Text-to-speech, standard quality
pch-documents $0.26 in / $1.48 out per M tokens bronze Document parsing / OCR
pch-transcribe $0.0008 / minute bronze Speech-to-text
pch-extract $0.012 / M tokens bronze Structured data extraction
pch-rerank $0.025 / M tokens bronze Reranking for RAG pipelines
pch-image $0.028 / image silver Text-to-image
pch-audio-premium $37.00 / M chars silver Text-to-speech, premium quality
pch-talk $0.001 / minute silver Voice conversation
claude-haiku Common rate silver Anthropic Claude Haiku
claude-sonnet Common rate gold Anthropic Claude Sonnet

PathCourseModel only operates on chat-completion shapes — for image/audio/transcription, use the PCH Python SDK directly.

Choosing a chat model:

  • Fast response, simple task → pch-fast
  • Complex reasoning, multi-step → pch-pro
  • Writing or reviewing code → pch-coder
  • Long context or premium reasoning → claude-sonnet (Gold tier)

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

License

MIT

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

pydantic_ai_pathcourse-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

pydantic_ai_pathcourse-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_ai_pathcourse-0.1.1.tar.gz.

File metadata

  • Download URL: pydantic_ai_pathcourse-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for pydantic_ai_pathcourse-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fe48dfb5dcd470b8de08fe85d2130e63719078de7b082b7abec0ba54d8389209
MD5 86466df0cc2e765003f9ac058e7cfd6f
BLAKE2b-256 c049b9b8c3cc216c0a9e580434a36aad2dc6abd790aa606a5d9e42e69bd08817

See more details on using hashes here.

File details

Details for the file pydantic_ai_pathcourse-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_ai_pathcourse-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae75be315f3dd3412ecf5da99cd1040091a5fe5fdb7bfbd45a2228328546ef89
MD5 0911d8c0ff641be087a64bb7d82ece97
BLAKE2b-256 fbedb2a4d7f8afb391c60fed07c907cdc68f14146ef935bee37db96f82b38fef

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