Skip to content

Access AgentRunResult.usage as a property in common.ai logging#68405

Open
kaxil wants to merge 1 commit into
apache:mainfrom
astronomer:fix-agentrunresult-usage-property
Open

Access AgentRunResult.usage as a property in common.ai logging#68405
kaxil wants to merge 1 commit into
apache:mainfrom
astronomer:fix-agentrunresult-usage-property

Conversation

@kaxil

@kaxil kaxil commented Jun 11, 2026

Copy link
Copy Markdown
Member

pydantic-ai deprecated calling AgentRunResult.usage() as a method, so every agent run that goes through log_run_summary currently emits a PydanticAIDeprecationWarning in task logs. This drops the parentheses at the single call site and updates the test mocks to set .usage as an attribute instead of a return_value.

No version-floor bump is needed: the provider floor pydantic-ai-slim>=1.99.0 already exposes usage as a deprecated-callable property (both access forms work there), so property access is valid across the whole supported range. Verified by running log_run_summary against a real AgentRunResult with PydanticAIDeprecationWarning escalated to an error: the property form is clean and the old method-call form raises.

image

pydantic-ai deprecated calling AgentRunResult.usage() as a method
(PydanticAIDeprecationWarning); it is a property since the version range
already covered by the provider floor (pydantic-ai-slim>=1.99.0 exposes
both forms). Drop the parentheses at the call site and update the test
mocks to set .usage as an attribute instead of a return_value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant