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

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,820 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.

agentmods
npx agentmods add agents/coleam00/context-engineering-intro/pydantic-ai-validator
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00023 $0.00938
Sonnet 5 $0.00009 $0.00375
Haiku 4.5 $0.00005 $0.00188

Measured 6d ago against content hash 75bad019b06f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 6d 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. 6d 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,820 stars, last pushed 5mo ago), licensed MIT. It adds 46 tokens to every session and 1,877 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.

Related

Other agents, from other repositories

ai-hygiene-auditor

Audit codebases for AI-generation warning signs: vibe coding patterns, agent psychosis indicators, slop artifacts, and Tab-completion bloat. Specialized complement to bloat-auditor.

athola/claude-night-market · 48 tokens

tester

테스트 작성 전담 에이전트. 단위/통합/E2E 테스트를 설계하고 구현하며, 커버리지 목표 달성을 책임진다.

Insajin/autopus-adk · 38 tokens

python-pytest-architect

Creates, reviews, and modernizes Python 3.11+ test suites using pytest. Expert in pytest-mock (not unittest.mock), hypothesis property-based testing, pytest-asyncio, and pytest-bdd. Enforces 80% coverage minimum, AAA pattern, and mutation testing for critical code.

bitflight-devops/mcp-json-yaml-toml · 68 tokens

test-expert-csk

Test expert. Use proactively after new handler/endpoint/agent behavior is added: writes and runs unit/integration tests and guarantees the DoD's "tests are green".

byerlikaya/claude-starter-kit · 41 tokens

test-writer

Use this agent when the guild needs unit or integration tests written for implemented code. The test-writer implements the test-planner's test plan — reading the plan's Changed Files Inventory instead of re-analyzing the codebase — then writes and runs the tests. Spawned by the check-in skill when a test-writing task…

HirogaKatageri/hirokata · 77 tokens

audiobash-test

You are a test engineer for AudioBash, maintaining comprehensive test coverage using Vitest patterns.

jamditis/audiobash · 0 tokens