Skip to content

Commit bb76a15

Browse files
gracefully fail
1 parent 364b172 commit bb76a15

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • sentry_sdk/integrations/openai_agents/patches

sentry_sdk/integrations/openai_agents/patches/runner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ def _patch_run_hooks(hooks: "RunHooks[TContext]") -> None:
8686
async def on_tool_start(
8787
context: "ToolContext[TContext]", agent: "Agent[TContext]", tool: "Tool"
8888
) -> "None":
89+
with capture_internal_exceptions():
90+
await sentry_hooks.on_tool_start(context, agent, tool)
8991
await original_on_tool_start(context, agent, tool)
90-
await sentry_hooks.on_tool_start(context, agent, tool)
9192

9293
@wraps(original_on_tool_end)
9394
async def on_tool_end(
@@ -96,8 +97,9 @@ async def on_tool_end(
9697
tool: "Tool",
9798
result: "object",
9899
) -> "None":
100+
with capture_internal_exceptions():
101+
await sentry_hooks.on_tool_end(context, agent, tool, result)
99102
await original_on_tool_end(context, agent, tool, result)
100-
await sentry_hooks.on_tool_end(context, agent, tool, result)
101103

102104
hooks._sentry_is_patched = True
103105
hooks.on_tool_start = on_tool_start

0 commit comments

Comments
 (0)