{"slug": "building-modular-ai-agent-features-with-pydantic-ai-capabilities", "title": "Building Modular AI Agent Features with Pydantic AI Capabilities", "summary": "A developer building a no-code AI agent platform with Pydantic AI introduced modular Capabilities for adding reusable features to agents. The Capabilities, created using AbstractCapability, allow agents to gain web research via Tavily Search API and email functionality via Resend. A Company Knowledge Capability combining vector search and graph queries was also demonstrated.", "body_md": "If you're building AI Agents with Pydantic AI, understanding **Capabilities** is invaluable - it's the recommended way to add modular, reusable features to your agents.\n\nThis tutorial is part of my ongoing Pydantic AI series on [YouTube](https://youtube.com/@joxiahdev), where I build a full no-code AI agent platform from scratch.\n\nA capability in Pydantic AI is a modular unit of behavior that can be passed to an AI agent.\n\nA capability can give your agent:\n\nThink of it as a plug-and-play feature module - build it once, attach it to any agent.\n\nCapabilities are created using the `Capability`\n\nor `AbstractCapability`\n\nclass:\n\n``` python\nfrom pydantic_ai.capabilities import AbstractCapability\n```\n\nUsing `AbstractCapability`\n\ngives you full control over instructions, tools, and behavior. It's Pydantic AI's recommended pattern if you're building a library or platform on top of the framework.\n\nIn this tutorial, I build a **Research Capability** powered by the Tavily Search API, and an **Email Capability** powered by Resend.\n\nHere's the research capability:\n\n``` python\nfrom pydantic_ai import FunctionToolset\nfrom pydantic_ai.capabilities import AbstractCapability\nfrom dataclasses import dataclass\nfrom pydantic_ai.common_tools.tavily import tavily_search_tool\nfrom settings import settings\n\n@dataclass\nclass ResearchCapability(AbstractCapability):\n    def get_instructions(self):\n        return \"You can use the Tavily search tool for research\"\n\n    def get_toolset(self):\n        toolset = FunctionToolset()\n        toolset.add_tool(tavily_search_tool(api_key=settings.tavily_api_key))\n        return toolset\n```\n\nThat's it - `get_instructions()`\n\ntells the agent what it can do, and `get_toolset()`\n\ngives it the tools to do it. Attach this to any agent, and it instantly gains web research abilities.\n\nI also built a **Company Knowledge Capability** that combines:\n\nThis lets an agent answer questions from your company's documents, website content, or any knowledge base with both vector search and relationship-aware graph queries.\n\nThis post covers the concept — the full video walks through building both capabilities live, plus the RAG/GraphRAG ingestion pipeline, observability with Logfire, and wiring it all into a working agent.\n\n🎥 [Watch on YouTube →](https://youtu.be/ILHtYme4O60)\n\n💻 [Full source code →](https://github.com/bjoxiah/pydantic-ai-series/tree/no-code-agent)\n\nWhile you're there, subscribe for more software and AI related content!", "url": "https://wpnews.pro/news/building-modular-ai-agent-features-with-pydantic-ai-capabilities", "canonical_source": "https://dev.to/joxiahdev/building-modular-ai-agent-features-with-pydantic-ai-capabilities-39d5", "published_at": "2026-06-14 08:30:00+00:00", "updated_at": "2026-06-14 08:59:11.316926+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "artificial-intelligence", "machine-learning", "natural-language-processing"], "entities": ["Pydantic AI", "Tavily Search API", "Resend", "Logfire", "YouTube", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/building-modular-ai-agent-features-with-pydantic-ai-capabilities", "markdown": "https://wpnews.pro/news/building-modular-ai-agent-features-with-pydantic-ai-capabilities.md", "text": "https://wpnews.pro/news/building-modular-ai-agent-features-with-pydantic-ai-capabilities.txt", "jsonld": "https://wpnews.pro/news/building-modular-ai-agent-features-with-pydantic-ai-capabilities.jsonld"}}