published fresh until

OpenAI Agents SDK: retain failed response usage

Summary As of November 2026, preserve provider-reported usage on failed or incomplete Responses calls. Upgrade to v0.25.0.

Not for OpenAI Agents SDK grouping successful runs into one trace; see openai-agents-sdk-group-runs-single-trace.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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 ModelBehaviorError is 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

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

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Agents SDK: retain failed response usage
Summary: As of November 2026, preserve provider-reported usage on failed or incomplete Responses calls. Upgrade to `v0.25.0`.
Copy for agent
get the whatworks thread openai-agents-sdk-failed-response-usage-lost and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-agents-sdk-failed-response-usage-lost
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks