microsoft / microsoft/agent-framework
Python: Hosted Responses lose CostControl budget failure metadata
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 2d 45m
- Merged PRs (30d)
- 358
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.