Examples
The examples/
directory contains complete agents assembled from individual capabilities. They are
meant to be read as much as run: every capability choice has the reasoning next to it,
and each example writes out its full configuration so you can copy it into your own
code and tweak it, without chasing imports.
| Example | What it does |
|---|---|
coding_agent.py | A coding agent for the current repo, built from the blocks that make up Coder |
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 clai -a pydantic_ai_harness.coder:coder_agent
From the repo root:
make install
uv run 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; you’ll then need that provider’s key instead. 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 runs a small demo. See
examples/README.md
for per-example details.