Pydantic AI 2.38

Last reviewed Sep 12, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. Python 3155 lines · 3.8K tokens
  2. Pydantic 2.1356 lines · 1.3K tokens
  3. Pydantic AI 2.38171 lines · 7.1K tokens
Total382 lines · 12.3K tokens

CWE Coverage

  • 20
  • 23
  • 36
  • 59
  • 78
  • 89
  • 95
  • 117
  • 201
  • 208
  • 209
  • 214
  • 250
  • 295
  • 306
  • 319
  • 328
  • 338
  • 346
  • 347
  • 367
  • 379
  • 407
  • 409
  • 416
  • 426
  • 427
  • 470
  • 488
  • 502
  • 522
  • 532
  • 611
  • 639
  • 674
  • 732
  • 770
  • 772
  • 776
  • 807
  • 829
  • 862
  • 915
  • 916
  • 918
  • 1104
  • 1284
  • 1287
  • 1333
  • 1395
  • 1426
  • 1427

Prompt Preview

Apply the Pydantic 2.13 and Python 3 prompts first, then these rules for agents built on pydantic-ai 2.38. V2 reorganized most per-run behavior behind the capabilities= argument, so treat a rule written against a V1 Agent(...) keyword as unverified until you find its V2 capability.

Version scope and dependencies

  • Lock pydantic-ai (or pydantic-ai-slim) to one exact release in the lock file, read the release notes before moving it, and move to the newest V2 release when a fix ships. Pydantic AI puts out a new V2 minor every few days, and its V2 patch releases have only ever gone to the newest minor at the time, never to an older one, so fixes for 2.38 arrive in later minors. The V1 maintenance line gets its own patch releases, which don't help a V2 deployment.
  • Run on a CPython minor that still gets security fixes. requires-python is >=3.10 and the package advertises 3.10 through 3.14, but a Python version is dropped only once it is past upstream end of life and under 5% of downloads, so an EOL interpreter such as 3.10 can stay nominally supported long after it stops getting CPython security fixes.
  • Keep pydantic at 2.12 or later, which the package requires, and treat pydantic-graph and pydantic-evals as version-locked siblings that must move with pydantic-ai.
  • Install only the extras the workload uses. Each of openai, anthropic, google, bedrock, mcp, ui, web, realtime, temporal, dbos, and prefect adds a distinct network or execution surface to the image.
  • Treat any module named beta as unstable: beta APIs may change