Skip to content

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.

ExampleWhat it does
coding_agent.pyA coding agent for the current repo, built from the blocks that make up Coder
research_agent.pyA 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:

Terminal
uvx --with pydantic-ai-harness clai -a pydantic_ai_harness.coder:coder_agent

Running an example

From the repo root:

Terminal
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.