Skip to content

Harness Examples

The examples/ directory contains complete agents to read, run, and copy into your own code.

ExampleWhat it does
coding_agent.pyA coding agent for the current repo: Coder in a local workspace
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[coder]" clai -a pydantic_ai_harness.coder:coder_agent

Running an example

From the repo root:

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