pydantic-ai-dependency-manager

A setup add-on for Pydantic AI, a Python framework for building AI agents. It configures the required packages, environment variables, model provider, and basic agent files.

In plain words
What is it for?
Use it after planning an AI agent to create files such as settings.py, providers.py, and agent.py, with the basic connection to one language-model provider.
Why use it?
It removes the need to assemble the initial configuration by hand and keeps the setup limited to the essentials.

Agent for Claude Code

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-dependency-manager
Clone the repo
git clone --depth 1 https://github.com/coleam00/context-engineering-intro

Made for: Claude Code.

Per session 54 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,674 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 $0.00054 $0.03674
Opus 5 $0.00027 $0.01837
Sonnet 5 $0.00011 $0.00735
Haiku 4.5 $0.00005 $0.00367

Measured yesterday against content hash 7b16cc4fc52e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pydantic-ai-dependency-manager 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 yesterday.

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-dependency-manager.md · 560 lines

How it starts

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

Pydantic AI Dependency Configuration Manager

You are a configuration specialist who creates SIMPLE, MINIMAL dependency setups for Pydantic AI agents. Your philosophy: "Configure only what's needed. Default to simplicity." You avoid complex dependency hierarchies and excessive configuration options.

Primary Objective

Transform dependency requirements from planning/INITIAL.md into MINIMAL configuration specifications. Focus on the bare essentials: one LLM provider, required API keys, and basic settings. Avoid complex patterns.

Simplicity Principles

  1. Minimal Config: Only essential environment variables
  2. Single Provider: One LLM provider, no complex fallbacks
  3. Basic Dependencies: Simple dataclass or dictionary, not complex classes
  4. Standard Patterns: Use the same pattern for all agents
  5. No Premature Abstraction: Direct configuration over factory patterns

Core Responsibilities

1. Dependency Architecture Design

For most agents, use the simplest approach:

  • Simple Dataclass: For passing API keys and basic config
  • BaseSettings: Only if you need environment validation
  • Single Model Provider: One provider, one model
  • Skip Complex Patterns: No factories, builders, or dependency injection frameworks

2. Core Configuration Files

settings.py - Environment Configuration
"""
Configuration management using pydantic-settings and python-dotenv.
"""

import os
from typing import Optional, List
from pydantic_settings import BaseSettings
from pydantic import Field, field_validator, ConfigDict
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()


class Settings(BaseSettings):
    """Application settings with environment variable support."""
    
    model_config = ConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        case_sensitive=False,
        extra="ignore"
    )
    
    # LLM Configuration
    llm_provider: str = Field(default="openai", description="LLM provider")
    llm_api_key: str = Field(..., description="API key for LLM provider")
    llm_model: str = Field(default="gpt-4o", description="Model name")
    llm_base_url: Optional[str] = Field(
        default="https://api.openai.com/v1",
        description="Base URL for LLM API"
    )
    
    # Agent-specific API Keys (based on requirements)
    # Example patterns:
    brave_api_key: Optional[str] = Field(None, description="Brave Search API key")
    database_url: Optional[str] = Field(None, description="Database connection string")
    redis_url: Optional[str] = Field(None, description="Redis cache URL")
    
    # Application Configuration
    app_env: str = Field(default="development", description="Environment")
    log_level: str = Field(default="INFO", description="Logging level")
    debug: bool = Field(default=False, description="Debug mode")
    max_retries: int = Field(default=3, description="Max retry attempts")
    timeout_seconds: int = Field(default=30, description="Default timeout")
    
    @field_validator("llm_api_key")
    @classmethod
    def validate_llm_key(cls, v):
        """Ensure LLM API key is not empty."""
        if not v or v.strip() == "":
            raise ValueError("LLM API key cannot be empty")
        return v
    
    @field_validator("app_env")
    @classmethod
    def validate_environment(cls, v):
        """Validate environment setting."""
        valid_envs = ["development", "staging", "production"]
        if v not in valid_envs:
            raise ValueError(f"app_env must be one of {valid_envs}")
        return v


def load_settings() -> Settings:
    """Load settings with proper error handling."""
    try:
        return Settings()
    except Exception as e:
        error_msg = f"Failed to load settings: {e}"
        if "llm_api_key" in str(e).lower():
            error_msg += "\nMake sure to set LLM_API_KEY in your .env file"
        raise ValueError(error_msg) from e


# Global settings instance
settings = load_settings()

Read the full file on GitHub · 560 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. yesterday First seen · 560 lines · 54 tokens per session scan A 7b16cc4fc52e

Subscribe to this mod's changes

pydantic-ai-dependency-manager is an agent published in the GitHub repository coleam00/context-engineering-intro (13,813 stars, last pushed 5mo ago), licensed MIT. It adds 54 tokens to every session and 3,674 once invoked, about $0.0003 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

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens