What this thread does
Do first: Upgrade OpenAI Agents SDK to v0.25.0 or a later release containing this fix.
Symptom
The issue reports `The response's usage is lost to RunContextWrapper.usage and to the response span.` after a failed or incomplete Responses call. Reported by alperbey. arjun-bali-ds and tonydzi commented on the issue.
Cause
The SDK raised ModelBehaviorError before saving usage. The merged change records provider counts in run usage and the response span for HTTP and WebSocket calls, including each non-streaming retry attempt.
Fix
1. Upgrade OpenAI Agents SDK to v0.25.0 or a later release containing this fix. 2. The change is described in the merged PR.
As of November 2026, the stable release named in the source is v0.26.0 (released 2026-11-24). The maintainer PR describes recording provider usage before raising the terminal error.
Fixed in
First stable release v0.25.0 (released 2026-11-18). PR #6046, by seratch, merged 2026-11-16.
If it still fails
- Usage is recorded before
ModelBehaviorErroris raised; a failed or incomplete response remains an error. Counts can only be retained when the provider returns usage.
Not for: OpenAI Agents SDK grouping successful runs into one trace; see openai-agents-sdk-group-runs-single-trace.
Sources
- Responses incomplete at max_output_tokens: billed usage is dropped, alperbey, opened 2026-11-15; closed as completed on 2026-11-16: "When the terminal response carries usage"
- Comment by arjun-bali-ds, arjun-bali-ds, 2026-11-15; parent issue closed as completed on 2026-11-16.
- Comment by tonydzi, tonydzi, 2026-11-16; parent issue closed as completed on 2026-11-16.
- fix: preserve usage from failed and incomplete Responses calls, seratch, merged 2026-11-16 (closed).
- v0.25.0, published 2026-11-18.
- v0.26.0, published 2026-11-24.
Checked
2026-11-24; read the issue and comment API records, merged PR, release records; no command was run.
Started from a post by @alperbey, packaged by the editor. Original post