pydanticai-docs

pydanticai-docs is a skill for Claude Code, Codex from DougTrajano/pydantic-ai-skills. It costs 133 tokens per session (1,301 once invoked), scanned A, original, MIT.

A documentation guide for Pydantic AI, a Python framework for building AI agents with typed data and tool calls. It covers agents, structured results, model providers, dependencies, streaming, and multi-agent patterns.

In plain words
What is it for?
Use it when building Pydantic AI agents, defining outputs with Pydantic models, adding function tools, passing dependencies through RunContext, or configuring providers such as OpenAI, Anthropic, and Gemini.
Why use it?
It helps you use the framework's current concepts and APIs without relying on incomplete or outdated knowledge. It also provides examples for common agent tasks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building Pydantic AI agents, defining outputs with Pydantic models, adding function tools, passing dependencies through RunContext, or configuring providers such as OpenAI, Anthropic, and Gemini.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dougtrajano/pydantic-ai-skills/pydanticai-docs
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add DougTrajano/pydantic-ai-skills --skill pydanticai-docs
Clone the repo
git clone --depth 1 https://github.com/DougTrajano/pydantic-ai-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pydanticai-docs

README.md
[![agentmods](https://agentmods.dev/badge/skills/dougtrajano/pydantic-ai-skills/pydanticai-docs/github.svg)](https://agentmods.dev/skills/dougtrajano/pydantic-ai-skills/pydanticai-docs)
Your own site
<a href="https://agentmods.dev/skills/dougtrajano/pydantic-ai-skills/pydanticai-docs"><img src="https://agentmods.dev/badge/skills/dougtrajano/pydantic-ai-skills/pydanticai-docs/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pydanticai-docs

Your own site · 80×15
<a href="https://agentmods.dev/skills/dougtrajano/pydantic-ai-skills/pydanticai-docs"><img src="https://agentmods.dev/badge/skills/dougtrajano/pydantic-ai-skills/pydanticai-docs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 133 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,301 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00133 $0.01301
Opus 5 $0.00067 $0.00651
Sonnet 5 $0.00027 $0.00260
Haiku 4.5 $0.00013 $0.00130

Measured 12d ago against content hash 3f15d3a6ac14, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

pydanticai-docs scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/skills/pydanticai-docs/SKILL.md · 122 lines

How it starts

The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pydantic AI Documentation Skill

What is Pydantic AI?

Pydantic AI is a production-grade Python agent framework for building type-safe, dependency-injected Generative AI applications. It supports multiple LLM providers, structured outputs via Pydantic models, and composable multi-agent patterns.

Doc: https://ai.pydantic.dev/


Core Concepts

1. Agent Instantiation

from pydantic_ai import Agent

agent = Agent(
    'openai:gpt-4o',          # model string: provider:model-name
    system_prompt='Be helpful.',
)
result = agent.run_sync('What is the capital of France?')
print(result.output)

For full constructor parameters, run methods, and streaming: load references/AGENT.md.

2. Function Tools (@agent.tool)

from pydantic_ai import Agent, RunContext

agent = Agent('openai:gpt-4o', deps_type=str)

@agent.tool
def get_user_name(ctx: RunContext[str]) -> str:
    """Return the current user's name."""
    return ctx.deps

result = agent.run_sync('What is my name?', deps='Alice')

Use @agent.tool_plain when you don't need RunContext. For tool registration, return types, and retries: load references/FUNCTION_TOOLS.md.

3. Dependency Injection (RunContext)

from dataclasses import dataclass
from pydantic_ai import Agent, RunContext

@dataclass
class MyDeps:
    api_key: str
    user_id: int

agent = Agent('openai:gpt-4o', deps_type=MyDeps)

@agent.tool
async def fetch_data(ctx: RunContext[MyDeps]) -> str:
    return f'User {ctx.deps.user_id}'

For RunContext fields, injection into system prompts and output validators: load references/DEPENDENCIES.md.

4. Structured Output

from pydantic import BaseModel
from pydantic_ai import Agent

class CityInfo(BaseModel):
    city: str
    country: str

agent = Agent('openai:gpt-4o', output_type=CityInfo)
result = agent.run_sync('Where were the 2012 Olympics held?')
print(result.output)  # CityInfo(city='London', country='United Kingdom')

Read the full file on GitHub · 122 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 122 lines · 133 tokens per session scan A 3f15d3a6ac14

Subscribe to this mod's changes

pydanticai-docs is a skill published in the GitHub repository DougTrajano/pydantic-ai-skills (369 stars, last pushed 4d ago), licensed MIT. It adds 133 tokens to every session and 1,301 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

agent-framework-py-release

Use when cutting a Python release for the microsoft/agent-framework monorepo. Triggers on "bump py versions", "cut a python release", "prepare release PR for python", "release py packages", "bump python to X.Y.Z", or similar requests to bump Python package versions and prepare a release PR. Handles all four lifecycle…

microsoft/agent-framework · 103 tokens

foundry-hosted-agent-validation

Step-by-step process for validating a Python Foundry hosted agent sample (under python/samples/04-hosting/foundry-hosted-agents/) end to end — running it locally (native runtime and azd ai agent run) and after deploying it to an Azure AI Foundry project with azd. Use this when asked to validate a hosted agent sample.

microsoft/agent-framework · 82 tokens

build-and-test

How to build and test .NET projects in the Agent Framework repository. Use this when verifying or testing changes.

microsoft/agent-framework · 26 tokens

python-feature-lifecycle

Guidance for package and feature lifecycle in the Agent Framework Python codebase, including stage meanings, feature-stage decorators, feature enums, and how to move APIs from one stage to the next.

microsoft/agent-framework · 43 tokens

python-development

Coding standards, conventions, and patterns for developing Python code in the Agent Framework repository. Use this when writing or modifying Python source files in the python/ directory.

microsoft/agent-framework · 35 tokens

foundry-config-setup

Resolve missing setup caused by a hardcoded Foundry project endpoint or model in a sample. Use when a sample fails because it uses a placeholder/hardcoded projectendpoint (for example "https://your-project.services.ai.azure.com") or a hardcoded model instead of reading them from the environment.

microsoft/agent-framework · 65 tokens