v1.98.0

pydantic/pydantic-aiv1.98.0May 19, 2026by DouweM

AI Summary

Adds OpenAI token counting, refactors Agent retry parameters, fixes MCP runtime requirements, and deprecates ACI for V2.

Key Highlights

  • Add OpenAI Responses input token counting
  • Replace Agent tool_retries/output_retries with unified retries parameter
  • Fix MCP to not require fastmcp.server at runtime
  • Deprecate pydantic_ai.ext.aci for V2

New Features

  • OpenAIResponsesModel.count_tokens
  • Agent retries parameter change

Full Release Notes

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

## What's Changed
### 🚀 Features
* Add OpenAI Responses input token counting (`OpenAIResponsesModel.count_tokens`) by @colesmcintosh in https://github.com/pydantic/pydantic-ai/pull/3951
* Replace `Agent` `tool_retries=`/`output_retries=` with `retries: int | AgentRetries` by @Kludex in https://github.com/pydantic/pydantic-ai/pull/5500
### 🐛 Bug Fixes
* fix(mcp): Don't require `fastmcp.server` at runtime by @Kymi808 in https://github.com/pydantic/pydantic-ai/pull/5514
### :new: V2 Preparation
* Deprecate `pydantic_ai.ext.aci` (`tool_from_aci` and `ACIToolset`) by @dsfaccini in https://github.com/pydantic/pydantic-ai/pull/5510

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

**Full Changelog**: https://github.com/pydantic/pydantic-ai/compare/v1.97.0...v1.98.0