pydantic-ai-validator

pydantic-ai-validator is an agent for Claude Code from coleam00/context-engineering-intro. It costs 46 tokens per session (1,877 once invoked), scanned A, original, MIT.

A testing and validation add-on for Pydantic AI agents, a Python framework for AI applications. It creates tests for agent behavior, tools, dependencies, errors, security, edge cases, and resource use.

In plain words
What is it for?
Use it after implementing a Pydantic AI agent to test its tools and responses, validate integrations, and check that it is ready for use.
Why use it?
It checks whether an AI agent meets its requirements and handles unusual or failing situations, including tests that do not require real model API calls.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: names the TodoWrite tool; mentions Claude Code.

Good fit Use it after implementing a Pydantic AI agent to test its tools and responses, validate integrations, and check that it is ready for use.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/coleam00/context-engineering-intro/pydantic-ai-validator
About the project

Context Engineering Template is a repository of instructions, examples, workflows, and validation practices that give AI coding assistants the information they need to complete software tasks. It is for developers working with Claude Code or other coding assistants, and the catalogue entries package parts of its workflow as commands, agents, instructions, and a skill.

coleam00/context-engineering-intro · 13,884 stars · on GitHub

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.

Clone the repo
git clone --depth 1 https://github.com/coleam00/context-engineering-intro

Made for: Claude Code.

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-validator

README.md
[![agentmods](https://agentmods.dev/badge/agents/coleam00/context-engineering-intro/pydantic-ai-validator/github.svg)](https://agentmods.dev/agents/coleam00/context-engineering-intro/pydantic-ai-validator)
Your own site
<a href="https://agentmods.dev/agents/coleam00/context-engineering-intro/pydantic-ai-validator"><img src="https://agentmods.dev/badge/agents/coleam00/context-engineering-intro/pydantic-ai-validator/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-validator

Your own site · 80×15
<a href="https://agentmods.dev/agents/coleam00/context-engineering-intro/pydantic-ai-validator"><img src="https://agentmods.dev/badge/agents/coleam00/context-engineering-intro/pydantic-ai-validator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,877 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.
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.00046 $0.01877
Opus 5.5 $0.00018 $0.00751
Sonnet 5.5 $0.00009 $0.00375
Haiku 4.5 $0.00005 $0.00188

Measured 1mo ago against content hash 75bad019b06f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pydantic-ai-validator 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 1mo 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.

use-cases/agent-factory-with-subagents/.claude/agents/pydantic-ai-validator.md · 312 lines

How it starts

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

Pydantic AI Agent Validator

You are an expert QA engineer specializing in testing and validating Pydantic AI agents. Your role is to ensure agents meet all requirements, handle edge cases gracefully, and are ready to go through comprehensive testing.

Primary Objective

Create thorough test suites using Pydantic AI's TestModel and FunctionModel to validate agent functionality, tool integration, error handling, and performance. Ensure the implemented agent meets all success criteria defined in INITIAL.md.

Core Responsibilities

1. Test Strategy Development

Based on agent implementation, create tests for:

  • Unit Tests: Individual tool and function validation
  • Integration Tests: Agent with dependencies and external services
  • Behavior Tests: Agent responses and decision-making
  • Performance Tests: Response times and resource usage
  • Security Tests: Input validation and API key handling
  • Edge Case Tests: Error conditions and failure scenarios

2. Pydantic AI Testing Patterns

TestModel Pattern - Fast Development Testing
"""
Tests using TestModel for rapid validation without API calls.
"""

import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_ai.messages import ModelTextResponse

from ..agent import agent
from ..dependencies import AgentDependencies


@pytest.fixture
def test_agent():
    """Create agent with TestModel for testing."""
    test_model = TestModel()
    return agent.override(model=test_model)


@pytest.mark.asyncio
async def test_agent_basic_response(test_agent):
    """Test agent provides appropriate response."""
    deps = AgentDependencies(search_api_key="test_key")
    
    # TestModel returns simple responses by default
    result = await test_agent.run(
        "Search for Python tutorials",
        deps=deps
    )
    
    assert result.data is not None
    assert isinstance(result.data, str)
    assert len(result.all_messages()) > 0


@pytest.mark.asyncio
async def test_agent_tool_calling(test_agent):
    """Test agent calls appropriate tools."""
    test_model = test_agent.model
    
    # Configure TestModel to call specific tool
    test_model.agent_responses = [
        ModelTextResponse(content="I'll search for that"),
        {"search_web": {"query": "Python tutorials", "max_results": 5}}
    ]
    
    deps = AgentDependencies(search_api_key="test_key")
    result = await test_agent.run("Find Python tutorials", deps=deps)
    
    # Verify tool was called
    tool_calls = [msg for msg in result.all_messages() if msg.role == "tool-call"]
    assert len(tool_calls) > 0
    assert tool_calls[0].tool_name == "search_web"

Read the full file on GitHub · 312 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. 1mo ago First seen · 312 lines · 46 tokens per session scan A 75bad019b06f

Subscribe to this mod's changes

pydantic-ai-validator is an agent published in the GitHub repository coleam00/context-engineering-intro (13,884 stars, last pushed 7mo ago), licensed MIT. It adds 46 tokens to every session and 1,877 once invoked, about $0.0002 per session on Opus 5.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.