Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions sentry_sdk/integrations/openai_agents/spans/ai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from ..consts import SPAN_ORIGIN
from ..utils import (
_create_mcp_execute_tool_spans,
_set_agent_data,
_set_input_data,
_set_output_data,
Expand Down Expand Up @@ -55,7 +54,6 @@ def update_ai_client_span(

if hasattr(response, "output") and response.output:
_set_output_data(span, response)
_create_mcp_execute_tool_spans(span, response)

if response_model is not None:
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, response_model)
Expand Down
24 changes: 1 addition & 23 deletions sentry_sdk/integrations/openai_agents/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
set_data_normalized,
truncate_and_annotate_messages,
)
from sentry_sdk.consts import OP, SPANDATA, SPANSTATUS
from sentry_sdk.consts import SPANDATA
from sentry_sdk.integrations import DidNotEnable
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.utils import event_from_exception, safe_serialize
Expand Down Expand Up @@ -215,25 +215,3 @@ def _set_output_data(span: "sentry_sdk.tracing.Span", result: "Any") -> None:
set_data_normalized(
span, SPANDATA.GEN_AI_RESPONSE_TEXT, output_messages["response"]
)


def _create_mcp_execute_tool_spans(
span: "sentry_sdk.tracing.Span", result: "agents.Result"
) -> None:
for output in result.output:
if output.__class__.__name__ == "McpCall":
with sentry_sdk.start_span(
op=OP.GEN_AI_EXECUTE_TOOL,
name=f"execute_tool {output.name}",
start_timestamp=span.start_timestamp,
) as execute_tool_span:
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
)
execute_tool_span.set_data(
SPANDATA.GEN_AI_TOOL_OUTPUT, output.output
)
if output.error:
execute_tool_span.set_status(SPANSTATUS.INTERNAL_ERROR)
Loading
Loading