Skip to content

Set gen_ai.tool.call.id on execute_tool spans and in message formatting #5834

@ericapisani

Description

@ericapisani

Extract tool_call_id from pydantic-ai's ToolCallPart and set it in two places:

  1. On gen_ai.execute_tool spans in sentry_sdk/integrations/pydantic_ai/spans/execute_tool.py
  2. In chat message serialization (tool call messages) in sentry_sdk/integrations/pydantic_ai/spans/ai_client.py

This helps correlate tool calls with their returns in multi-tool scenarios. The attribute is recommended by OTel.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions