pydantic-ai-harness  by pydantic

Extend AI agents with modular capabilities and tools

Created 1 month ago
266 stars

Top 96.0% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Pydantic AI Harness provides a modular library of tools, hooks, and configurations to extend the capabilities of Pydantic AI agents. It serves as the official capability extension for the Pydantic AI framework, allowing developers to pick and choose components to build specialized agents like coding assistants or research tools. The library aims to offer standalone building blocks that can eventually graduate into the core Pydantic AI framework as they prove essential.

How It Works

The core concept revolves around "capabilities," which are bundles of functionalities like tools, lifecycle hooks, instructions, and model settings. These capabilities are designed to extend agent functionality without requiring changes to the core framework. A key feature is CodeMode, which leverages the Monty sandbox to allow agents to orchestrate multiple tool calls via Python code within a single run_code execution, replacing sequential model round-trips. Another example is MCP (Meta-Capability Protocol), which enables agents to connect to external MCP servers, such as GitHub's official MCP server for accessing code-related functionalities.

Quick Start & Requirements

  • Installation: uv add pydantic-ai-harness
  • Extras: For CodeMode, install with uv add "pydantic-ai-harness[codemode]".
  • Prerequisites: Requires Python 3.10+ and pydantic-ai-slim>=1.80.0.
  • Documentation: References are available for Pydantic AI Logfire, capabilities, hooks, extensibility, and toolsets.

Highlighted Details

  • CodeMode provides sandboxed Python execution via Monty, consolidating multiple tool calls into a single run_code operation.
  • Includes developing capabilities for file system access (read, write, edit, search with path traversal prevention) and shell command execution (with allowlists, denylists, and timeouts).
  • Features advanced context management, including sliding windows, LLM-powered summarization, and limit warnings to handle conversation history efficiently.
  • Offers memory solutions such as persistent key-value storage, session persistence, and conversation checkpointing.
  • Implements comprehensive safety and guardrails, including input/output validation, cost/token budgets, tool access control, secret masking, and approval workflows.

Maintenance & Community

The library is maintained by the Pydantic AI team. Community input is actively sought through a "Help us prioritize" section, where users can vote on planned capabilities via issues and pull requests. A detailed contribution guide is provided, encouraging community involvement in developing and refining capabilities.

Licensing & Compatibility

The project is licensed under the MIT License, which generally permits commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

The project currently uses 0.x versioning, indicating that APIs are still stabilizing and minor releases may introduce breaking changes. Many advanced capabilities, such as file system operations, shell execution, advanced context management, memory features, and various safety guardrails, are still under active development, as indicated by their status in the capability matrix.

Health Check
Last Commit

12 hours ago

Responsiveness

Inactive

Pull Requests (30d)
54
Issues (30d)
7
Star History
266 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.