Repository navigation
Fix Common AI durable retries and tool-approval resumes on pydantic-ai 2.50+ - #74313
Merged
Merged
Conversation
…i 2.50+ pydantic-ai 2.50 added a float field to RunUsage, audio_seconds. The task state store loader required every count field to be an int, so the usage it had saved on the first attempt (audio_seconds=0.0) failed to load on the retry or resume with "is not an int (got 0.0)". Float fields now load as floats.
vatsrahul1001
approved these changes
Oct 6, 2026
eladkal
approved these changes
Oct 6, 2026
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On pydantic-ai-slim 2.50 or later, an
AgentOperatorretry withdurable=True, and the resume after a tool approval, fail on Airflow 3.3+ when they load the usage the earlier attempt saved:pydantic-ai 2.50 added
audio_seconds: floattoRunUsage(seconds of audio billed, for voice models).load_run_usageinutils/usage_budget.pywalks everyRunUsagefield and, apart fromcostanddetails, requires an int. The first attempt saves the usage withaudio_seconds=0.0, so the retry or resume cannot read it back. The provider allowspydantic-ai-slim>=2.33.0, so any install that has picked up 2.50+ is affected; CI did not catch it becauseuv.lockpins 2.48.0.Fields declared as
floatnow load as floats, still rejecting strings and bools; count fields keep the int check. The loader already carries any newRunUsagefield through automatically, so this only teaches it the second numeric type.With pydantic-ai-slim 2.52.0 installed, 15 existing tests in
test_agent.py(durable usage-budget retries) andtest_agent_tool_approval.py(approve, reject, timeout and cancel on resume) fail onmainwith the error above and pass with this change. The new tests include a round trip throughTypeAdapter(RunUsage), the path the resume uses, which runs on every pydantic-ai version, so a future field of another type fails it instead of being skipped.{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.