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)