Skip to content
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

Fix: Improve serialization of completions/responses in Agents SDK instrumentation #845

Closed
wants to merge 2 commits into from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Fix: Improve serialization of completions/responses in Agents SDK instrumentation

This PR fixes the serialization of completions/responses in the Agents SDK OpenTelemetry instrumentation. Instead of truncating or printing the string representation of the object, it now extracts specific fields referenced in the semconv definitions.

Changes

  • Added model_as_dict() helper function to safely convert response objects to dictionaries
  • Updated _export_span() method to extract specific fields from response objects:
    • Model information
    • Response ID
    • System fingerprint
    • Token usage metrics
    • Completion content and metadata
    • Function/tool call information

Benefits

  • Increases the number of attributes from 2 to 13+ for each response
  • Preserves structured data instead of truncating to string
  • Maintains compatibility with different response object formats
  • Follows semantic convention standards

Link to Devin run: https://app.devin.ai/sessions/480cc142d3b94f70828c01815f3622ef

This is a draft PR for exploring potential solutions to the problem.

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

Closing due to inactivity for more than 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants