v2.31.0

pydantic/pydantic-aiv2.31.0Aug 15, 2026by dsfaccini

AI Summary

This release introduces flexibility in UI event stream construction and fixes issues related to model fallback attribution and OpenAI resource imports.

Key Highlights

  • Allow `UIEventStream` to be built without a `run_input`
  • Give `AGUIEventStream` its own `thread_id` and `run_id`
  • Attribute `FallbackModel` spans to the failing model
  • Pass `openai` through Temporal workflow sandboxes

New Features

  • UIEventStream can be built without run_input
  • AGUIEventStream gets its own thread_id and run_id

Full Release Notes

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

## What's Changed
### 🚀 Features
* Allow a `UIEventStream` to be built without a `run_input`, and give `AGUIEventStream` its own `thread_id`/`run_id` by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/7292
### 🐛 Bug Fixes
* Attribute failed `FallbackModel` spans to the failing model, not the `fallback:` wrapper by @strawgate in https://github.com/pydantic/pydantic-ai/pull/7018
* Pass `openai` through Temporal workflow sandboxes by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/7464

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

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