pydantic-ai-tool-system

pydantic-ai-tool-system is a skill for Claude Code from existential-birds/beagle. It costs 44 tokens per session (1,349 once invoked), scanned A, original, Apache-2.0.

A system for adding callable tools to PydanticAI agents with the correct context, type annotations, and documentation. PydanticAI is a Python framework for building agents.

In plain words
What is it for?
Use it when creating agent actions, choosing between context-aware and standalone tools, and checking signatures and Google-style docstrings.
Why use it?
It prevents common registration mistakes, such as using the wrong decorator or omitting the information the agent needs to understand a tool.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the beagle-ai plugin — 13 skills shipped together

Good fit Use it when creating agent actions, choosing between context-aware and standalone tools, and checking signatures and Google-style docstrings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/existential-birds/beagle/pydantic-ai-tool-system
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 existential-birds/beagle --skill pydantic-ai-tool-system
Clone the repo
git clone --depth 1 https://github.com/existential-birds/beagle

Made for: Claude Code.

Or install beagle-ai, the plugin that ships this one along with the rest of its 13 skills.

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 pydantic-ai-tool-system

README.md
[![agentmods](https://agentmods.dev/badge/skills/existential-birds/beagle/pydantic-ai-tool-system/github.svg)](https://agentmods.dev/skills/existential-birds/beagle/pydantic-ai-tool-system)
Your own site
<a href="https://agentmods.dev/skills/existential-birds/beagle/pydantic-ai-tool-system"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/pydantic-ai-tool-system/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 pydantic-ai-tool-system

Your own site · 80×15
<a href="https://agentmods.dev/skills/existential-birds/beagle/pydantic-ai-tool-system"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/pydantic-ai-tool-system.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,349 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.00044 $0.01349
Opus 5 $0.00022 $0.00674
Sonnet 5 $0.00009 $0.00270
Haiku 4.5 $0.00004 $0.00135

Measured 9d ago against content hash 2b91d4f3181c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

pydantic-ai-tool-system 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 9d 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.

plugins/beagle-ai/skills/pydantic-ai-tool-system/SKILL.md · 216 lines

How it starts

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

PydanticAI Tool System

Tool Registration

Two decorators based on whether you need context:

from pydantic_ai import Agent, RunContext

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

# @agent.tool - First param MUST be RunContext
@agent.tool
async def get_user_data(ctx: RunContext[MyDeps], user_id: int) -> str:
    """Get user data from database.

    Args:
        ctx: The run context with dependencies.
        user_id: The user's ID.
    """
    return await ctx.deps.db.get_user(user_id)

# @agent.tool_plain - NO context parameter allowed
@agent.tool_plain
def calculate_total(prices: list[float]) -> float:
    """Calculate total price.

    Args:
        prices: List of prices to sum.
    """
    return sum(prices)

Critical Rules

  1. @agent.tool: First parameter MUST be RunContext[DepsType]
  2. @agent.tool_plain: MUST NOT have RunContext parameter
  3. Docstrings: Required for LLM to understand tool purpose
  4. Google-style docstrings: Used for parameter descriptions

Gates (verify in the file, not from memory)

  1. Decorator matches signature — If the first parameter is RunContext[...], the decorator must be @agent.tool (not @agent.tool_plain). Pass: the same def line’s decorator stack includes @agent.tool, and the first parameter is typed RunContext[...].
  2. Plain tools — With @agent.tool_plain, the parameter list must not include RunContext. Pass: a quick scan of the signature shows no RunContext.
  3. Docstring for the model — Non-empty docstring; if the tool has parameters, describe them (Google Args: or Sphinx :param when using docstring_format='sphinx'). Pass: each parameter in the signature is mentioned in the docstring body.

Docstring Formats

Google style (default):

@agent.tool_plain
async def search(query: str, limit: int = 10) -> list[str]:
    """Search for items.

    Args:
        query: The search query.
        limit: Maximum results to return.
    """

Sphinx style:

@agent.tool_plain(docstring_format='sphinx')
async def search(query: str) -> list[str]:
    """Search for items.

    :param query: The search query.
    """

Read the full file on GitHub · 216 lines

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. 9d ago First seen · 216 lines · 44 tokens per session scan A 2b91d4f3181c

Subscribe to this mod's changes

pydantic-ai-tool-system is a skill published in the GitHub repository existential-birds/beagle (80 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 44 tokens to every session and 1,349 once invoked, about $0.0002 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.