Add metadata to failed Agent Server responses - #49073
Open
banibrata-de wants to merge 3 commits into
Open
banibrata-de wants to merge 3 commits into
banibrata-de wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 99113cf0-df56-4e0f-979a-a7d39a173e4d
Contributor
|
Thank you for your contribution banibrata-de! We will review the pull request and get back to you soon. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 99113cf0-df56-4e0f-979a-a7d39a173e4d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 99113cf0-df56-4e0f-979a-a7d39a173e4d
banibrata-de
marked this pull request as ready for review
September 18, 2026 04:28
banibrata-de
requested review from
Ravi Pidaparthi (RaviPidaparthi),
Shiva S (Shivakishore14),
Ankit Sinha (ankitbko) and
Pranav Pandit (vangarp)
as code owners
September 18, 2026 04:28
Contributor
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
|
Azure Pipelines: Successfully started running 1 pipeline(s). 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
| raise ValueError(f"metadata value for key '{key}' exceeds the 512-character limit") | ||
| merged[key] = value | ||
|
|
||
| if len(merged) > 16: |
There was a problem hiding this comment.
what is driving these limits? could these limits change in the future?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds optional validated metadata to
ResponseEventStream.emit_failed. The metadata is merged with request-provided response metadata and follows the Responses limits of 16 keys, 64 characters per key, and 512 characters per value.This enables hosting adapters and ordinary Agent Server handlers to attach structured failure details to the terminal
response.failedsnapshot while preserving the Responses transport contract. For example, a budget rejection can remain outer HTTP 200 while exposingerror.code=budget_exceededand string-valuedmetadata.costControl.The change does not interpret HTTP headers or add CostControl-specific behavior to the generic SDK. The handler or hosting adapter remains responsible for selecting, sanitizing, and supplying public metadata.
Validation
stream=falseJSON responses andstream=trueSSE responses.response.failed,error.code=budget_exceeded, and boundedmetadata.costControl.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines