Pydantic AI Harness is the capability library for Pydantic AI agents that take on long-running, complex work such as fixing a codebase or researching a question for hours unattended. Pydantic AI already supplies a light harness (the typed agent loop, any model, tools, and structured output). This package adds what such agents need around the model: a workspace to act in, a plan, memory across sessions, sub-agents, context management, and durable execution. Development has moved into the Pydantic AI repository, and the package now ships with every Pydantic AI release.
Everything is built from one primitive, the capability: a self-contained unit of agent behavior added to an agent's capability list. There are more than 50 across Pydantic AI core and this package, and they compose with each other and with your own. Two complete agents are themselves combined capabilities: Coder (file tools, a persistent shell, delegation to itself, repository context, and context controls) and Researcher (web search, page fetching, a delegated sub-researcher, and bounded tool output). Either can be used whole or rebuilt from its parts to change any setting.
Every run is observable through OpenTelemetry spans for each model and tool call, with Logfire as one backend. Agents can be served to editors such as Zed over the Agent Client Protocol (experimental), or through Pydantic AI's web chat UI, CLI, frontend adapters (AG-UI, Vercel AI), and realtime voice.
Features
- Execution environments: file system tools safe against path traversal, a shell with allowlists, denylists and timeouts, and a Modal cloud sandbox
- App connectors: GitHub, Linear, Notion, Google Workspace, Slack, StackOne, PostHog, Grain, Day AI, Pylon, Ordinal, LocalStack, and Macroscope
- Web research: Exa and You.com search and research, plus Browser Use and Playwright browser control
- Planning and delegation: model-owned task plans, named sub-agents, an advisor model, background tools, and scripted sub-agent workflows with call budgets
- Code Mode: the model writes one Python script that calls many tools inside a Monty sandbox, keeping intermediate results out of the context window
- Context management: tool-result clearing, sliding-window trimming, LLM summarization, tool output limits, and prompt-cache bust warnings
- Memory and knowledge: a persistent namespaced notebook with in-memory, file, or Postgres stores, BM25 conversation search, on-demand Agent Skills, and repository context
- Control and safety: guardrails with secret masking, a prompt injection defender, spend limits, tool argument repair, system reminders, and a trajectory judge
- Self-extension: the agent writes, validates, and persists new capabilities for the next run
- Durable runs: AWS Lambda durable steps and step persistence to save, resume, and fork runs on file, SQLite, or Mongo backends
- Managed prompts: instructions backed by a Logfire-managed prompt that can be versioned without redeploying


