{"name":"Pydantic AI Harness: Enhancing Your AI Agents with Robust Capabilities","description":"Pydantic AI Harness is the official capability and harness library for Pydantic AI, designed to extend agents for complex, long-running tasks. It provides a modular system of \"capabilities\" for functionalities like file system interaction, web research, memory, and sub-agent delegation. This library enables developers to build sophisticated and durable AI agents with ease.","github":"https://github.com/pydantic/pydantic-ai-harness","url":"https://osrepos.com/repo/pydantic-pydantic-ai-harness","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/pydantic-pydantic-ai-harness","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/pydantic-pydantic-ai-harness.md","json":"https://osrepos.com/repo/pydantic-pydantic-ai-harness.json","topics":["Python","AI","Agents","Framework","Machine Learning","Capabilities","Developer Tools","Open Source"],"keywords":["Python","AI","Agents","Framework","Machine Learning","Capabilities","Developer Tools","Open Source"],"stars":null,"summary":"Pydantic AI Harness is the official capability and harness library for Pydantic AI, designed to extend agents for complex, long-running tasks. It provides a modular system of \"capabilities\" for functionalities like file system interaction, web research, memory, and sub-agent delegation. This library enables developers to build sophisticated and durable AI agents with ease.","content":"## Introduction\n\nPydantic AI Harness, built on Pydantic AI, provides a comprehensive set of \"capabilities\" to empower your AI agents for complex and long-running tasks. It extends the core Pydantic AI framework by offering advanced functionalities like workspace management, planning, persistent memory, sub-agent delegation, and robust context management.\n\n**Important Note**: This repository is being merged into [Pydantic AI](https://github.com/pydantic/pydantic-ai \"Pydantic AI GitHub Repository\") and will be archived. Development for `pydantic-ai-harness` and `pydantic-clai2` now continues within the `pydantic/pydantic-ai` repository, specifically in `src/pydantic_ai_harness` and `src/pydantic_clai2`. Please direct new issues and pull requests to the [Pydantic AI repository](https://github.com/pydantic/pydantic-ai/issues \"Pydantic AI Issues\"). The PyPI package names will remain the same, with future releases published from Pydantic AI.\n\n## Why Use and Key Benefits\n\nWhile Pydantic AI provides a lean harness for simple agents, Pydantic AI Harness steps in when agents need to tackle more demanding work, such as fixing a codebase, conducting extensive research, or operating unattended for hours. It ships with a rich set of primitives, each a \"capability,\" a self-contained unit of agent behavior that you can easily add to your agent's configuration.\n\nKey benefits include:\n\n*   **Extended Functionality**: Provides essential components like a workspace for agent actions, a dynamic plan, memory that persists across sessions, and sub-agents for task delegation.\n*   **Robust Context Management**: Ensures agents remain coherent and efficient during long runs with advanced context management and durable execution capabilities.\n*   **Modularity and Composability**: With over 50 capabilities, you can snap on single blocks, compose your own stacks, or start with complete agents like `Coder` and `Researcher` and customize them as needed.\n*   **Comprehensive Tooling**: Offers a wide array of tools for execution environments (FileSystem, Shell), external system integrations (GitHub, Linear, Notion), web and research (Web Search, Exa Search), reasoning and planning, context management, knowledge and memory, and control and safety.\n\n## Installation\n\nPydantic AI Harness requires Python 3.10 or newer. It installs `pydantic-ai-slim` automatically, so you don't need to install Pydantic AI separately.\n\nUsing `uv`:\n\nbash\nuv add pydantic-ai-harness\n\n\nUsing `pip`:\n\nbash\npip install pydantic-ai-harness\n\n\nModel providers and the CLI can be added via extras, for example: `pydantic-ai-harness[anthropic]` or `pydantic-ai-harness[cli]`. Some capabilities may also require their own specific extras for optional dependencies.\n\n## Examples\n\nHere are a few examples demonstrating how to use Pydantic AI Harness capabilities:\n\n### Quick Start with Coder Agent\n\nThe `Coder` capability provides six tools, including `read_file`, `write_file`, `edit_file`, `list_files`, `grep`, and `shell`, plus `delegate_task` for sub-tasks.\n\npython\nfrom pydantic_ai import Agent\nfrom pydantic_ai_harness import Coder\n\nagent = Agent('anthropic:claude-fable-5', capabilities=[Coder()])\n\nresult = agent.run_sync('Find out why tests/test_parser.py fails and fix the bug it caught.')\nprint(result.output)\n#> Found it: `parse()` returned None on empty input instead of raising. Fixed in src/parser.py; tests pass now.\n\n\n### Enhancing Coder with Web Search and Memory\n\nYou can easily combine capabilities to create more powerful agents. Here, a `Coder` agent is augmented with `WebSearch` for online lookups and `Memory` for cross-session persistence.\n\npython\nfrom pydantic_ai import Agent\nfrom pydantic_ai.capabilities import WebSearch\nfrom pydantic_ai_harness import Coder, Memory\nfrom pydantic_ai_harness.memory import FileStore\n\nagent = Agent(\n    'openai:gpt-5.6-sol',\n    capabilities=[\n        Coder(),\n        WebSearch(),  # look up docs and error messages on the web\n        Memory(FileStore('.agent-memory')),  # remembers across sessions\n    ],\n)\n# agent.run_sync(...)\n\n\n### Composing a Research Agent from Blocks\n\nCapabilities are modular, allowing you to build custom agents by combining individual components. This example shows how to construct a research agent, similar to the pre-built `Researcher` capability.\n\npython\nfrom pydantic_ai import Agent\nfrom pydantic_ai.capabilities import WebFetch, WebSearch\nfrom pydantic_ai_harness import SubAgent, SubAgents, ToolOutputLimits\n\nsub_researcher = SubAgent(\n    Agent(\n        name='researcher',\n        description='Research a focused sub-question on the web and report back with findings and source links',\n        capabilities=[WebSearch(local=True), WebFetch(local=True), ToolOutputLimits()],\n    )\n)\n\nagent = Agent(\n    'anthropic:claude-fable-5',\n    capabilities=[\n        WebSearch(local=True),  # native provider search, DuckDuckGo fallback elsewhere\n        WebFetch(local=True),  # read the pages behind the results, native or local\n        SubAgents(agents=[sub_researcher], agent_folders=None),\n        ToolOutputLimits(),  # fetched pages don't flood the context\n    ],\n)\n\nresult = agent.run_sync('What changed in the top three Python agent frameworks this month? Cite sources.')\nprint(result.output)\n#> ...\n\n\n## Links\n\n*   **GitHub Repository**: [pydantic/pydantic-ai-harness](https://github.com/pydantic/pydantic-ai-harness \"Pydantic AI Harness GitHub Repository\")\n*   **Pydantic AI (New Home)**: [pydantic/pydantic-ai](https://github.com/pydantic/pydantic-ai \"Pydantic AI GitHub Repository\")\n*   **PyPI**: [pydantic-ai-harness](https://pypi.python.org/pypi/pydantic-ai-harness \"Pydantic AI Harness on PyPI\")\n*   **Join Slack**: [Pydantic Community Slack](https://logfire.pydantic.dev/docs/join-slack/ \"Join Pydantic Community Slack\")\n*   **Pydantic Logfire**: [AI-first, full-stack observability](https://pydantic.dev/logfire \"Pydantic Logfire\")","metrics":{"detailViews":1,"githubClicks":0},"dates":{"published":null,"modified":"2026-09-28T20:14:02.000Z"}}