From b397f327270b39cf88e076a7c4850dab27099ccf Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Fri, 17 Apr 2026 13:25:57 +0200 Subject: [PATCH] fix: Stringify gen_ai.tool.input attribute --- sentry_sdk/integrations/openai_agents/spans/execute_tool.py | 2 +- sentry_sdk/integrations/openai_agents/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/integrations/openai_agents/spans/execute_tool.py b/sentry_sdk/integrations/openai_agents/spans/execute_tool.py index 12a4fe30a5..4a7bf70de0 100644 --- a/sentry_sdk/integrations/openai_agents/spans/execute_tool.py +++ b/sentry_sdk/integrations/openai_agents/spans/execute_tool.py @@ -29,7 +29,7 @@ def execute_tool_span( if should_send_default_pii(): input = args[1] - span.set_data(SPANDATA.GEN_AI_TOOL_INPUT, input) + span.set_data(SPANDATA.GEN_AI_TOOL_INPUT, safe_repr(input)) return span diff --git a/sentry_sdk/integrations/openai_agents/utils.py b/sentry_sdk/integrations/openai_agents/utils.py index 7acc3506be..394aad085e 100644 --- a/sentry_sdk/integrations/openai_agents/utils.py +++ b/sentry_sdk/integrations/openai_agents/utils.py @@ -228,7 +228,7 @@ def _create_mcp_execute_tool_spans( execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_NAME, output.name) if should_send_default_pii(): execute_tool_span.set_data( - SPANDATA.GEN_AI_TOOL_INPUT, output.arguments + SPANDATA.GEN_AI_TOOL_INPUT, safe_repr(output.arguments) ) execute_tool_span.set_data( SPANDATA.GEN_AI_TOOL_OUTPUT, safe_repr(output.output)