skillfed

pydantic-ai-harness

The batteries for your Pydantic AI agent

pydantic-ai-harness v0.20.0 2.1M downloads/30d#3,303 on PyPI768
Permissive license MIT Active released

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-harness

uv

uv add pydantic-ai-harness

poetry

poetry add pydantic-ai-harness

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: LibrariesTyping :: Typed

Tags

pydantic ai agent capabilitiesagent tools and extensionscode execution sandbox for agentssub-agent orchestrationai agent harness libraryagent workflow compositionllm tool batching
agent-orchestrationllm-toolssandbox-execution

More Libraries packages

Further reading