-
Notifications
You must be signed in to change notification settings - Fork 3.2k
adding agent id to response generation trace #44416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding agent id to response generation trace #44416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds agent ID to response generation traces for improved telemetry tracking in Azure Monitor. The change enables better trace filtering and debugging by including the agent ID alongside the existing agent name in telemetry spans. This enhancement is particularly useful for viewing traces in the Microsoft Foundry portal.
Key Changes
- Extended the responses instrumentor to extract and include agent ID in trace spans
- Added comprehensive test coverage for both streaming and non-streaming scenarios
- Updated sample code to demonstrate proper agent ID inclusion in response generation
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
_responses_instrumentor.py |
Added agent_id parameter to span creation and implemented _extract_agent_id() method to parse agent ID from request kwargs |
test_responses_instrumentor.py |
Added two new test methods for non-streaming and streaming responses with agent ID verification |
test_responses_instrumentor_async.py |
Added async equivalents of the new test methods for comprehensive async coverage |
sample_agent_basic_with_azure_monitor_tracing.py |
Updated sample to demonstrate responses API with agent ID in the extra_body parameter |
README.md |
Added documentation note explaining the importance of passing agent ID for portal trace viewing |
CHANGELOG.md |
Documented the new tracing feature and sample update |
assets.json |
Updated asset tag to reflect test recording changes |
adding agent id to response generation trace