Harness Examples
The examples/
directory contains complete agents to read, run, and copy into your own code.
| Example | What it does |
|---|---|
coding_agent.py | A coding agent for the current repo: Coder in a local workspace |
research_agent.py | A web-research agent that cites every claim, built from the blocks that make up Researcher |
If you just want the assembled version, every packaged harness (Coder,
Researcher, …) is one import, or zero, via the
CLI:
uvx --with "pydantic-ai-harness[coder]" clai -a pydantic_ai_harness.coder:coder_agent
From the repo root:
make install
uv run src/pydantic_ai_harness/examples/coding_agent.py
Each example states its default model at the top and reads the corresponding API key
from the environment (e.g. ANTHROPIC_API_KEY). Set PYDANTIC_AI_MODEL=provider:model
to run it against a different model with that provider’s key. See
the model configuration docs for
provider setup.
Every example exposes a build_agent() factory you can import and embed in your own
code, and a main() that starts an interactive session. See
examples/README.md
for per-example details.