Pydantic AI
davila7/claude-code-templates
Build production-ready AI agents with PydanticAI — type-safe tool use, structured outputs, dependency injection, and multi-model support.
PydanticAI — Typed AI Agents in Python workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
$ npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install diegosouzapw/awesome-omni-skills pydantic-ai --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/diegosouzapw/awesome-omni-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills_omni/pydantic-ai .claude/skills/pydantic-ai && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "pydantic-ai" agent skill from https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-ai into .claude/skills/pydantic-ai/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-aiType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install diegosouzapw/awesome-omni-skills pydantic-ai --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/diegosouzapw/awesome-omni-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills_omni/pydantic-ai .agents/skills/pydantic-ai && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "pydantic-ai" agent skill from https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-ai into .agents/skills/pydantic-ai/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install diegosouzapw/awesome-omni-skills pydantic-ai --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/diegosouzapw/awesome-omni-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills_omni/pydantic-ai .cursor/skills/pydantic-ai && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "pydantic-ai" agent skill from https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-ai into .cursor/skills/pydantic-ai/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/diegosouzapw/awesome-omni-skills.git --path skills_omni/pydantic-ai--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install diegosouzapw/awesome-omni-skills pydantic-ai --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/diegosouzapw/awesome-omni-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills_omni/pydantic-ai .gemini/skills/pydantic-ai && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "pydantic-ai" agent skill from https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-ai into .gemini/skills/pydantic-ai/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install diegosouzapw/awesome-omni-skills pydantic-aiInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/diegosouzapw/awesome-omni-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills_omni/pydantic-ai .github/skills/pydantic-ai && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "pydantic-ai" agent skill from https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-ai into .github/skills/pydantic-ai/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install diegosouzapw/awesome-omni-skills pydantic-ai --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/diegosouzapw/awesome-omni-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills_omni/pydantic-ai .opencode/skills/pydantic-ai && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "pydantic-ai" agent skill from https://github.com/diegosouzapw/awesome-omni-skills/tree/main/skills_omni/pydantic-ai into .opencode/skills/pydantic-ai/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "pydantic-ai", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
pydantic-aiPydanticAI — Typed AI Agents in Python workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
Pydantic AI is an agent skill from diegosouzapw/awesome-omni-skills. PydanticAI — Typed AI Agents in Python workflow skill. Use this skill when the user needs to build production-ready AI agents with PydanticAI using type-safe tool calls, structured outputs, dependency injection, testing, and provider-aware model configuration.
Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 22 other files, including scripts, reference files and assets (for example `ATTRIBUTION.md`, `OMNI_ENHANCED.json` and `ORIGIN.md`).
It sits in AI & LLM Engineering, covering Structured output and tool calling, Design patterns and Type safety. It works with Python and Pydantic AI. The repository describes itself as: Public repository of AI coding skills, curated improved best-practice skills, and runtime surfaces for CLI, API, MCP, and A2A. The licence is MIT.
2 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit c3af004. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 1 file in scripts/ (Python, from the files we listed), which the agent can run.
Shell commands in SKILL.md call:
pythonpipFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
ai.pydantic.devplatform.openai.comdocs.pydantic.devFrom URLs in SKILL.md, links to its own repository left out.
Names these keys or tokens, usually read from environment variables:
OPENAI_API_KEYFrom names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Pydantic AI loads about 3.2k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 68 tokens; SKILL.md has 1,345 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from diegosouzapw/awesome-omni-skills at commit c3af004, republished under its MIT licence (© diegosouzapw). 1,345 words, ~3,225 tokens.
.claude/skills/pydantic-ai/SKILL.md (or your agent's skills folder). This skill also uses 17 other files; get the full folder from GitHub.Use this skill when you need a Python agent that should:
PydanticAI is most useful when correctness, schema validation, and maintainability matter more than a quick prompt-only prototype.
This enhanced version preserves the original skill identity while converting the workflow into an execution-oriented guide. Use the support pack when you need deeper runtime practices, a worked example, or a preflight environment check.
Use this skill when:
Agent, result_type, tools, RunContext, retries, testing, evals, or provider switchingDo not use this skill as the first choice when:
| Goal | Start here | Validate before moving on | Fallback |
|---|---|---|---|
| Install and run a first agent | Step 1 and scripts/validate-runtime.py | Python version, package install, provider env vars, model string | Use a simpler provider/model pair and re-run preflight |
| Produce structured outputs | Step 2 and Structured Outputs and Result Models | Result model validates without post-hoc string parsing | Simplify the schema and tighten field instructions |
| Add tool use safely | Tools and Dependency Injection | Tool args are narrow, typed, and deterministic | Split one broad tool into smaller tools |
| Inject runtime state | Tools and Dependency Injection | External clients/config passed via dependencies, not globals | Create a dependency container/dataclass |
| Test behavior locally | Testing and Evals | Core logic and schema behavior pass without live LLM dependency | Mock the model/tool boundary first |
| Debug failures | Troubleshooting and references/runtime-practices.md | You can identify whether the issue is schema, tool, or provider config | Reproduce with a minimal agent and one tool |
Install the base library plus the provider extras required for the model you plan to use.
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install "pydantic-ai-slim[openai]"Provider extras vary by backend. Keep these boundaries explicit:
Recommended preflight checks:
pydantic_ai imports cleanlyRun the included preflight script before debugging agent logic:
python scripts/validate-runtime.py --provider openai --require-env OPENAI_API_KEYStart with one agent, one prompt, one typed result.
from pydantic import BaseModel, Field
from pydantic_ai import Agent
class SupportAnswer(BaseModel):
answer: str = Field(description="Direct response to the user question")
confidence: float = Field(ge=0.0, le=1.0)
agent = Agent(
"openai:gpt-4o-mini",
result_type=SupportAnswer,
system_prompt=(
"Answer the user briefly and return a confidence score between 0 and 1."
),
)
result = agent.run_sync("How do I reset my password?")
print(result.output)Good first-run target:
If this does not validate, fix the schema or provider setup before adding complexity.
Prefer result_type and schema-backed outputs over parsing free-form text.
BaseModel, dataclasses, or other supported typed structuresjson.loads() on arbitrary unvalidated text if a typed result can be enforcedSee references/runtime-practices.md for schema design rules and failure handling.
A good tool:
A risky tool:
Use dependencies for items such as:
This keeps prompts focused on behavior while runtime concerns stay in Python objects.
from dataclasses import dataclass
from pydantic import BaseModel
from pydantic_ai import Agent, RunContext
@dataclass
class AppDeps:
kb: dict[str, str]
class LookupResult(BaseModel):
answer: str
source: str
agent = Agent(
"openai:gpt-4o-mini",
deps_type=AppDeps,
result_type=LookupResult,
system_prompt="Use tools when needed. Cite the source key you used.",
)
@agent.tool
def lookup_policy(ctx: RunContext[AppDeps], topic: str) -> str:
return ctx.deps.kb.get(topic, "not found")When tool calls fail, check these first:
See examples/implementation-example.md for a full pattern with one dependency and one tool.
Treat testing and evals as separate stages.
Minimum workflow:
A short worked example and test sketch are in examples/implementation-example.md.
Symptoms:
Checks:
Symptoms:
Checks:
Symptoms:
Checks:
Use a minimal reproduction:
If the minimal version works, reintroduce components one at a time until the failure returns.
references/runtime-practices.md — operational notes for schema design, tool design, provider preflight, testing, evals, and observabilityexamples/implementation-example.md — end-to-end example with typed result, one tool, one dependency, expected output, and a test sketchscripts/validate-runtime.py — preflight script for Python version, imports, and provider environment checksPrimary documentation:
Prefer a different skill when:
Stay with this skill when the center of gravity is typed Python agents, validated outputs, tool use, and testable runtime behavior.
© diegosouzapw, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 17 other files (scripts, references, assets) in skills_omni/pydantic-ai of diegosouzapw/awesome-omni-skills.
Open the folder on GitHubat commit c3af004
Pydantic AI next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Pydantic AI this skilldiegosouzapw/awesome-omni-skills | 159 | — | ~3.2k | Automated safety check: Pass | MIT | |
| Pydantic AIdavila7/claude-code-templates | 32k | 3 repos | ~2.9k | Automated safety check: Pass | MIT | |
| Pydanticaimagnus919/agent-skills | 116 | — | ~4k | Automated safety check: Pass | MIT | |
| Building Pydantic AI Agentsdocling-project/docling | 69k | — | ~2.8k | Automated safety check: Pass | MIT | |
| Celeste Pythonwithceleste/celeste-python | 221 | — | ~1.1k | Automated safety check: Pass | MIT | |
| Outlines Structured GenerationOrchestra-Research/AI-Research-SKILLs | 13k | 9 repos | ~4k | Automated safety check: Pass | MIT |
davila7/claude-code-templates
Build production-ready AI agents with PydanticAI — type-safe tool use, structured outputs, dependency injection, and multi-model support.
magnus919/agent-skills
Build type-safe AI agents and graph-based workflows with PydanticAI and PydanticGraph.
docling-project/docling
Patterns and tested examples for building agents with Pydantic AI: tools, capabilities, structured output, dependency injection, hooks, YAML specs, streaming and testing.
withceleste/celeste-python
A skill your agent uses whenever writing, modifying, reviewing, or debugging code involving Celeste, celeste-ai, celeste-python, import celeste, src/celeste, or withceleste app integrations.
Orchestra-Research/AI-Research-SKILLs
Uses the Outlines library to constrain model output to a JSON schema, Pydantic model, regex or fixed set of choices when running local models.
pydantic/skills
Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns.
diegosouzapw/awesome-omni-skills
Content Creator workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
diegosouzapw/awesome-omni-skills
Helm Chart Scaffolding workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
diegosouzapw/awesome-omni-skills
Prompt Engineering Patterns workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
diegosouzapw/awesome-omni-skills
Prompt Engineering Patterns workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
diegosouzapw/awesome-omni-skills
📝 Prompt Library workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
diegosouzapw/awesome-omni-skills
Protocol Reverse Engineering workflow skill. An agent skill from diegosouzapw/awesome-omni-skills.
Works with
Categories
PydanticAI — Typed AI Agents in Python workflow skill. An agent skill from diegosouzapw/awesome-omni-skills. Pydantic AI is an agent skill from diegosouzapw/awesome-omni-skills. PydanticAI — Typed AI Agents in Python workflow skill.
Pydantic AI fits situations like: the user needs to build production-ready AI agents with PydanticAI using type-safe tool calls; structured outputs; dependency injection; provider-aware model configuration.
Run `npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a claude-code`. Or copy the skill folder (skills_omni/pydantic-ai in diegosouzapw/awesome-omni-skills) into .claude/skills/pydantic-ai in your project. Claude Code loads it when a task matches its description.
Run `npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a codex`. Or copy the skill folder (skills_omni/pydantic-ai in diegosouzapw/awesome-omni-skills) into .agents/skills/pydantic-ai in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add diegosouzapw/awesome-omni-skills --skill pydantic-ai -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pydantic-ai, .gemini/skills/pydantic-ai, .github/skills/pydantic-ai and .opencode/skills/pydantic-ai in your project.
Going by SKILL.md and its folder, Pydantic AI needs Python for the scripts in its folder, the command-line tools its instructions call (python and pip) and credentials named OPENAI_API_KEY. Our summary lists: Python 3; A credential in OPENAI_API_KEY.
SKILL.md names 3 domains. As links in the text: ai.pydantic.dev, platform.openai.com and docs.pydantic.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Pydantic AI is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Pydantic AI: Pydantic AI (davila7/claude-code-templates, 32k stars), Pydanticai (magnus919/agent-skills, 116 stars), Building Pydantic AI Agents (docling-project/docling, 69k stars) and Celeste Python (withceleste/celeste-python, 221 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
diegosouzapw (a GitHub user) maintains it in diegosouzapw/awesome-omni-skills, which has 159 GitHub stars. The repository holds 39 skills in this directory. The repository was last updated on July 8, 2026.
Source: diegosouzapw/awesome-omni-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.