agentleFS
PydanticKnown publisherpydantic/pydantic-ai/pydantic_ai_slim/pydantic_ai/AGENTS.md

pydantic-ai / pydantic_ai

AGENTS.md20k starsChanged 2 months agoMITView on GitHub

For non-trivial changes to this package, also read Pydantic AI Slim Architecture.

Trending

Quiet since October.about the whole repository

Jan 2026: 0 mentionsFeb 2026: 2 mentionsMar 2026: 2 mentionsApr 2026: 29 mentionsMay 2026: 2 mentionsJun 2026: 2 mentionsJul 2026: 3 mentionsAug 2026: 1 mentionSep 2026: 0 mentionsOct 2026: 1 mentionNov 2026: 0 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the pydantic/pydantic-ai repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about pydantic/pydantic-ai

The biggest 5 of 64 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 64

Talked about on GitHub, Bluesky, Hacker News and the web (64 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 7

2 more on Bluesky

On Hacker News · 5

On the web · 2

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add capability flags to model profile classes instead of inline isinstance() checks — prevents scattered feature detection logic — …

    line 10
  2. Very specific:

    Avoid Any type annotations — use Union, Protocol, TypeVar, or schema-derived types for precision — Precise types catch bugs at type-check …

    line 27
  3. Very specific:

    Use TypedDict or dataclass instead of dict[str, Any] when structure is known — Enables static type checking, eliminates cast() calls, …

    line 29
  4. Very specific:

    Use keyword-only params (place * after first 1-2 positional args) for optional/config parameters — Prevents breakage when adding parameters …

    line 41

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md
<!-- braindump: rules extracted from PR review patterns -->

pydantic_ai_slim/pydantic_ai/ Guidelines

For non-trivial changes to this package, also read Pydantic AI Slim Architecture.

API Design

<!-- rule:587 -->
  • Add capability flags to model profile classes instead of inline isinstance() checks — prevents scattered feature detection logic — Centralizing feature support as boolean flags (e.g., bedrock_supports_prompt_caching) in profile classes makes capability detection maintainable and prevents duplicating provider/model type checks across usage sites.
<!-- rule:716 -->
  • Configure provider-specific API features in Provider.model_profile(), not in model profile functions — model profiles should contain only intrinsic model characteristics — Keeps provider-agnostic model traits separate from provider-specific API behaviors, enabling models to work consistently across different providers
<!-- rule:264 -->
  • Store provider-specific metadata in structured provider_details or provider_metadata fields, not in id, content, or args — Prevents semantic field overloading and enables consistent provider behavior interpretation while keeping main fields normalized across providers
<!-- rule:17 -->
  • In _otel_*.py modules, implement only spec-defined features — no custom additions from internal concepts or other standards — Prevents spec drift and ensures compatibility with external tooling that expects standard-compliant telemetry data
<!-- rule:266 -->
  • Store provider metadata (provider_details, provider_name, id, signature) in dedicated provider_metadata fields, not encoded in string fields — Prevents data loss during JSON serialization/deserialization cycles across storage, UI exchange, and provider round-trips — structured metadata survives where encoded strings lose type information
<!-- rule:987 -->
  • Extend WrapperToolset for cross-cutting toolset behavior — don't modify base classes or individual toolset implementations — Composable wrappers (like ApprovalRequiredToolset, DeferredLoadingToolset) apply features to any toolset without coupling or duplication

Type System

<!-- rule:185 -->
  • End exhaustive if/elif chains with else: assert_never(value) for typed unions — Catches unhandled union variants at type-check time when unions are extended, preventing runtime errors from missing cases
<!-- rule:60 -->
  • Avoid Any type annotations — use Union, Protocol, TypeVar, or schema-derived types for precision — Precise types catch bugs at type-check time and improve IDE autocomplete; when Any is unavoidable due to external constraints, document expected structure in docstrings
<!-- rule:238 -->
  • Use TypedDict or dataclass instead of dict[str, Any] when structure is known — Enables static type checking, eliminates cast() calls, provides runtime validation, and self-documents expected structure

Code Style

<!-- rule:552 -->
  • Consolidate methods with duplicated logic using helpers, delegation, or type overloads — Reduces maintenance burden and prevents bugs from divergent implementations of the same control flow
<!-- rule:41 -->
  • Order required fields before optional fields in dataclasses — Python requires non-default args before defaults — This prevents syntax errors since Python's dataclass implementation enforces that fields without defaults must precede fields with defaults

General

<!-- rule:40 -->
  • Use keyword-only params (place * after first 1-2 positional args) for optional/config parameters — Prevents breakage when adding parameters and eliminates positional argument confusion in functions with multiple optional parameters
<!-- rule:71 -->
  • Prefix provider-specific fields with {provider}_ in ModelSettings subclasses and profiles — prevents confusion about which provider supports which parameters — Clear provider namespacing prevents users from assuming a field works across providers when it's actually provider-specific, reducing API misuse
<!-- rule:894 -->
  • Consolidate try/except blocks catching the same exception into one block — reduces duplication and simplifies control flow — When multiple operations throw the same exception type with similar handling logic, merging the try blocks prevents code duplication and makes error handling easier to maintain and update consistently.
<!-- /braindump -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.