building-pydantic-ai-agents

Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns. Use when the user mentions Pydantic AI, imports pydantic_ai, or asks to build an AI agent, add tools/capabilities, defer capability loading, stream output, define agents from YAML, or test agent behavior.

Install
npx skills add 'https://github.com/pydantic/pydantic-ai/tree/main/pydantic_ai_slim/pydantic_ai/.agents/skills/building-pydantic-ai-agents'
Download bundle ↓
main · 9e9fdc4Scanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Task Reference Map

This file exists as a compatibility index for older links into COMMON-TASKS.md.

Prefer the narrower task-family guides below so the agent loads only the material it needs:

Add Capabilities to an Agent

Read Add Capabilities.

Apply Progressive Disclosure

Read Capabilities on Demand.

Intercept Agent Lifecycle with Hooks

Read Intercept Agent Lifecycle with Hooks.

Define Agents Declaratively with Specs

Read Define Agents Declaratively with Specs.

Enable Thinking Across Providers

Read Enable Thinking Across Providers.

Use MCP Servers

Read Use MCP Servers.

Search with DuckDuckGo, Tavily, or Exa

Read Search with DuckDuckGo, Tavily, or Exa.

Require Tool Approval (Human in the Loop)

Read Require Tool Approval.

Send Images, Audio, Video, or Documents to the Model

Read Send Images, Audio, Video, or Documents to the Model.

Manage Context Size

Read Manage Context Size.

Work with Message History

Read Work with Message History.

Show Real-Time Progress

Read Run Methods and Streaming.

Handle Provider Failures

Read Handle Provider Failures.

Make an Agent Resilient with Retries

Read Make an Agent Resilient with Retries.

Debug a Failed Agent Run

Read Debug a Failed Agent Run.

Test Agent Behavior

Read Test Agent Behavior.

Coordinate Multiple Agents

Read Coordinate Multiple Agents.

Build Multi-Step Workflows with Graphs

Read Build Multi-Step Workflows with Graphs.

Debug and Validate Agent Behavior

Read Debug and Validate Agent Behavior.

Advanced and Less Common Features

Read only the relevant section in ORCHESTRATION-AND-INTEGRATIONS.md:

Working with the Installed Pydantic AI Package

Prefer the checked-out repository or these bundled references first.

Inspect local package source only as a last resort when:

  • the user asks about a symbol that is not covered in this skill
  • the local environment already includes pydantic_ai and you need exact module layout
  • you have no narrower offline reference available
Referenced from SKILL.md