Index of every page on this site: llms.txt
All skills
pydantic avatar

/building-pydantic-ai-agents

@b2d64a3
by pydanticpydantic/pydantic-ai21k stars
3,221
Run it yourself

Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, 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, attach a workspace, defer capability loading, stream output, define agents from YAML, or test agent behavior.

Use this Skill: https://skilld.dev/gh/pydantic/pydantic-ai/building-pydantic-ai-agents

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesCOMMON-TASKS.md

≈1.5k tokens on demand. Your agent reads this file only when SKILL.md points to it.

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.

Configure Prompt Caching Across Providers

Read Configure Prompt Caching Across Providers.

Debug Low Cache Hit Rate

Read the debugging checklist in Configure Prompt Caching 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.

Create a Basic Agent

Read Create a Basic Agent. The starter includes logfire.configure() and logfire.instrument_pydantic_ai(), so the first run is already traced in Logfire.

Set Up Observability with Logfire

Read Set Up Observability and Model Access, then Debug and Validate Agent Behavior.

Reach Every Model with One Key

Read Choose or Configure Models for gateway/ model strings through the Pydantic AI Gateway.

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

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides comprehensive guidance for building AI agents using the Pydantic AI framework. It correctly identifies security considerations for powerful features like code execution, file system access, and credential management, providing appropriate warnings and best practices for their safe use.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at b2d64a3. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 days ago
compatibility
Requires Python 3.11+
metadata
{
  "version": "1.1.2",
  "author": "pydantic"
}

README badge

README badge for pydantic/pydantic-ai/building-pydantic-ai-agents