v1.31.0

pydantic/pydantic-aiv1.31.0Dec 12, 2025by DouweM

AI Summary

Restores prompt caching support for AWS Bedrock and adds new methods for schema generation and provider URLs. It also adds GPT-5.2 support and updates OpenAI library.

Key Highlights

  • Add prompt caching support for AWS Bedrock
  • Add `Agent.output_json_schema()` method
  • Add `provider_url` to `ModelResponse`
  • Add GPT-5.2 and bump openai to v2.11.0

New Features

  • Prompt caching support
  • JSON schema generation method
  • Provider URL in ModelResponse
  • GPT-5.2 support
  • OpenAI library update

Full Release Notes

## What's Changed
* Add prompt caching support for AWS Bedrock by @DenysMoskalenko in https://github.com/pydantic/pydantic-ai/pull/3438
* Add `Agent.output_json_schema()` method by @g-eoj in https://github.com/pydantic/pydantic-ai/pull/3454
* Allow custom `clientInfo` when connecting to MCP servers by @atinylittleshell in https://github.com/pydantic/pydantic-ai/pull/3572
* Add `provider_url` to `ModelResponse` and use it in `cost()` by @mahiro72 in https://github.com/pydantic/pydantic-ai/pull/3648
* Add GPT-5.2 and bump openai to v2.11.0 by @DouweM in https://github.com/pydantic/pydantic-ai/pull/3713
* Allow model to be a string in `LLMJudge` by @samuelcolvin in https://github.com/pydantic/pydantic-ai/pull/3711
* Fix `OpenAIResponsesModel` web search `find_in_page` action handling by @DouweM in https://github.com/pydantic/pydantic-ai/pull/3709

## New Contributors
* @mahiro72 made their first contribution in https://github.com/pydantic/pydantic-ai/pull/3648
* @atinylittleshell made their first contribution in https://github.com/pydantic/pydantic-ai/pull/3572

**Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.30.0...v1.31.0