Python: Hosted Responses lose CostControl budget failure metadata

Open
#8,487 1 comment 0 reactions 1 assignee View on GitHub

@eavanvalkenburg is already working on this.

Since Sep 18, 2026.

Assessment

This issue has not been assessed yet.

Description

foundry hosting python reproduced

When a Foundry-hosted Agent Framework Responses agent receives a streaming model failure caused by a CostControl budget block, the raw model response includes x-ms-budget-cause: budget_exceeded and related budget headers. The OpenAI streaming SDK later raises a generic APIError from the SSE error event, and the hosting adapter currently emits a generic response.failed with error.code: server_error.

Expected behavior:

  • Preserve the allowlisted CostControl response headers across the streaming exception boundary.
  • Emit response.failed.error.code as budget_exceeded.
  • Include compact CostControl details in response metadata so streaming and non-streaming Responses clients can render the correct budget-block experience.

The outer Responses HTTP status should remain protocol-compatible; this issue concerns the terminal failure body and metadata.

Dominant language
Python
Stars
13.6k
Forks
2.3k
Avg merge
1d 20h
Merged PRs (30d)
342

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/agent-framework

All issues in microsoft/agent-framework

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.