pydantic-ai-harness
The batteries for your Pydantic AI agent
What it is and what it does
Pydantic AI Harness is the official capability library for Pydantic AI, maintained by the Pydantic AI team. It provides reusable building blocks—tools, lifecycle hooks, instructions, and model settings—that compose into agents to add functionality like code execution, web search, sub-agent orchestration, and external service integrations. The core framework ships only capabilities requiring deep model or framework support; everything else lives in this harness library, where new capabilities can start as experimental and graduate into core once they stabilize.
The library centers on two orchestration patterns: CodeMode lets the model write a single Python script batching multiple tool calls into one round-trip instead of sequential calls, and DynamicWorkflow does the same for sub-agents—allowing an orchestrator to fan out work across multiple agents and collect results in a single model call. Optional extras let you add specialized capabilities only when needed: sandboxed code execution, web research, browser automation, MongoDB persistence, and more. The library is actively maintained and designed modularly—install the base package and add only the extras your use case requires.
Use it for:
- Build a coding agent that executes and tests code in a sandbox without leaving the model's control flow.
- Orchestrate multiple sub-agents (reviewer, summarizer, fact-checker) in a single model call instead of sequential delegations.
- Batch web search and tool calls so the model gathers information and processes it in one round-trip.
- Integrate an agent with external business applications or serve it over the Agent Client Protocol.
- Persist agent steps and externalize media to MongoDB for audit trails and long-running workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pydantic AI Harness provides pre-built capabilities and tools that extend Pydantic AI agents—including code execution sandboxes, web search, sub-agent orchestration, and integrations with external services—without requiring framework changes.
Yes. Pydantic AI Harness is actively maintained by the Pydantic team, has low install friction, carries no security vulnerabilities, and offers a modular approach to extending agents with pre-built capabilities. Install the base package and add extras only for the specific capabilities you need. The library is in Alpha (Development Status 3), so expect some APIs to evolve, but core use cases are production-ready and backed by a well-resourced team.
Install
pydantic-ai-harness on PyPI
pip
pip install pydantic-ai-harnessuv
uv add pydantic-ai-harnesspoetry
poetry add pydantic-ai-harnessInstalling pydantic-ai-harness
Before you install
Low install friction; pure Python wheel with three runtime dependencies (pydantic-ai-slim, httpx, genai-prices). Active maintenance with recent release and 768 repository stars. Optional extras for specialized capabilities add dependencies only when needed.
License in practice
MIT license (permissive); you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pydantic-ai-harness
from pydantic_ai_harness import CodeMode
capabilities = [CodeMode()]
# Pass to your agent's capabilities parameter
Requires Python 3.10+ and pydantic-ai-slim>=2.18.0. Some optional extras (browser-use) require Python 3.11+.
Verify before relying
- Production readiness status of each optional extra (codemode, modal, exa, browser-use, stackone, acp, mongodb).
- Performance characteristics and latency overhead of CodeMode sandboxing and DynamicWorkflow orchestration.
- Stability guarantees for DynamicWorkflow, noted as subject to breaking changes during planned extensions.
- Whether the Monty sandbox, Modal SDK, and other optional dependencies are included in the extras or must be installed separately.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — genai-prices, httpx, pydantic-ai-slim |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,090,330/month — #3,303 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pydantic_ai_harness-0.20.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pydantic-aiPydantic AI is a Python framework for building…
permissive · top 5,000 on PyPI
pydantic-deepA Python framework and terminal assistant for…
permissive · top 15,000 on PyPI
pydantic-ai-shieldsPydantic AI Shields provides guardrail…
permissive · top 15,000 on PyPI
pydantic-ai-skillsTeaches agents to handle specialized tasks…
permissive · top 5,000 on PyPI
pydantic-ai-slimPydantic AI Slim provides core agent framework…
permissive · top 1,000 on PyPI
pydantic-ai-backendProvides sandboxed execution and file…
permissive · top 15,000 on PyPI
pydantic-ai-todoAdds task planning and tracking tools to…
permissive · top 15,000 on PyPI
agent-utilitiesA batteries-included harness for building…
permissive · top 15,000 on PyPI
pydantic-montyProvides Python bindings to execute untrusted…
permissive · top 5,000 on PyPI
pydantic-graphA graph and finite state machine library that…
permissive · top 1,000 on PyPI