v2.42.0

pydantic/pydantic-aiv2.42.0Sep 9, 2026by dsfaccini

AI Summary

This release introduces a new GitHub Copilot provider, improves validation for tool results, and includes several bug fixes for Anthropic Bedrock and JSON schema handling.

Key Highlights

  • Added a `GitHubCopilotProvider` to support GitHub Copilot's OpenAI-compatible API.
  • Enforced validation for `DeferredToolResults.approvals` to reject invalid values.
  • Fixed handling of `anthropic_disallows_sampling_settings` in `BedrockConverseModel`.
  • Resolved non-object `$ref` definitions in code-mode function signatures.

Breaking Changes

  • Invalid `DeferredToolResults.approvals` values are now rejected.

New Features

  • GitHubCopilotProvider

Full Release Notes

<!-- Release notes generated using configuration in .github/release.yml at main -->

## What's Changed
### ⚠️ Compatibility Notes
* Reject invalid `DeferredToolResults.approvals` values by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/8081
### 🚀 Features
* Add a `GitHubCopilotProvider` for GitHub Copilot's OpenAI-compatible API by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8059
### 🐛 Bug Fixes
* Honor `anthropic_disallows_sampling_settings` in `BedrockConverseModel` by @rscholz98 in https://github.com/pydantic/pydantic-ai/pull/7961
* Resolve non-object `$ref` definitions inline in code-mode function signatures by [@pydanty](https://github.com/apps/pydanty) in https://github.com/pydantic/pydantic-ai/pull/8056
* Validate `ToolReturnContent` without a Python call per JSON node by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7823
* Preserve Anthropic recovery across normalized history by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/8040

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

**Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v2.41.0...v2.42.0