v1.27.0

pydantic/pydantic-aiv1.27.0Dec 5, 2025by DouweM

AI Summary

This release allows dynamic configuration of built-in tools via RunContext, supports tool and resource caching for MCP servers with change notifications, and adds VercelAIAdapter.dump_messages for message conversion.

Key Highlights

  • Allow dynamic configuration of built-in tools via RunContext
  • Support tool and resource caching for MCP servers with change notifications
  • Support raw CoT reasoning from LM Studio and OpenAI Responses-compatible APIs
  • Fix structured output with nested definitions via Gemini
  • Add VercelAIAdapter.dump_messages to convert Pydantic AI messages to Vercel AI messages

New Features

  • Dynamic tool configuration via RunContext
  • MCP server caching with change notifications
  • Raw Chain of Thought reasoning support
  • Structured output fix for nested definitions
  • VercelAIAdapter message conversion utility

Full Release Notes

## What's Changed
* feat: Allow dynamic configuration of built-in tools via RunContext by @AlanPonnachan in https://github.com/pydantic/pydantic-ai/pull/3600
* Support tool and resource caching for MCP servers that support change notifications by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3560
* Support raw CoT reasoning from LM Studio and other OpenAI Responses-compatible APIs by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3559
* Fix structured output with nested definitions with Gemini via OpenRouter by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3618
* fix: Copy `extra_headers` to allow `model_settings` reuse  by @Wh1isper in https://github.com/pydantic/pydantic-ai/pull/3628
* Add `VercelAIAdapter.dump_messages` to convert Pydantic AI messages to Vercel AI messages by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/3392
* Disable use of `tool_choice=required` for deepseek-reasoner by @ZeroAurora in https://github.com/pydantic/pydantic-ai/pull/3644
* Use custom reasoning field for OpenRouter by @xcpky in https://github.com/pydantic/pydantic-ai/pull/3626

## New Contributors
* @AlanPonnachan made their first contribution in https://github.com/pydantic/pydantic-ai/pull/3600

**Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.26.0...v1.27.0