REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.38 KB
Close
/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/integrations/openai_agents/spans/execute_tool.py
Text
Base64
import sentry_sdk from sentry_sdk.consts import OP, SPANDATA, SPANSTATUS from sentry_sdk.scope import should_send_default_pii from ..consts import SPAN_ORIGIN from ..utils import _set_agent_data from typing import TYPE_CHECKING if TYPE_CHECKING: import agents from typing import Any def execute_tool_span(tool, *args, **kwargs): # type: (agents.Tool, *Any, **Any) -> sentry_sdk.tracing.Span span = sentry_sdk.start_span( op=OP.GEN_AI_EXECUTE_TOOL, name=f"execute_tool {tool.name}", origin=SPAN_ORIGIN, ) span.set_data(SPANDATA.GEN_AI_OPERATION_NAME, "execute_tool") if tool.__class__.__name__ == "FunctionTool": span.set_data(SPANDATA.GEN_AI_TOOL_TYPE, "function") span.set_data(SPANDATA.GEN_AI_TOOL_NAME, tool.name) span.set_data(SPANDATA.GEN_AI_TOOL_DESCRIPTION, tool.description) if should_send_default_pii(): input = args[1] span.set_data(SPANDATA.GEN_AI_TOOL_INPUT, input) return span def update_execute_tool_span(span, agent, tool, result): # type: (sentry_sdk.tracing.Span, agents.Agent, agents.Tool, Any) -> None _set_agent_data(span, agent) if isinstance(result, str) and result.startswith( "An error occurred while running the tool" ): span.set_status(SPANSTATUS.ERROR) if should_send_default_pii(): span.set_data(SPANDATA.GEN_AI_TOOL_OUTPUT, result)
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
agent_workflow.py
469 B
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ai_client.py
1.26 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
execute_tool.py
1.38 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
handoff.py
525 B
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
invoke_agent.py
2.43 KB
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
353 B
lrw-r--r--
2025-12-03 08:02:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).