You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(openai-agents): Patch execute_final_output() functions following library refactor (#5453)
`RunImpl.execute_final_output()` was moved to `agents.run_internal.turn_resolution.execute_final_output()`.
Patch the new function by reusing existing wrapper logic.
Copy file name to clipboardExpand all lines: sentry_sdk/integrations/openai_agents/__init__.py
+30-5Lines changed: 30 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
_execute_handoffs,
12
12
_create_run_wrapper,
13
13
_create_run_streamed_wrapper,
14
-
_patch_agent_run,
14
+
_execute_final_output,
15
15
_patch_error_tracing,
16
16
)
17
17
@@ -60,9 +60,6 @@ def _patch_runner() -> None:
60
60
agents.run.DEFAULT_AGENT_RUNNER.run_streamed
61
61
)
62
62
63
-
# Creating the actual spans for each agent run (works for both streaming and non-streaming).
64
-
_patch_agent_run()
65
-
66
63
67
64
classOpenAIAgentsIntegration(Integration):
68
65
"""
@@ -82,7 +79,7 @@ class OpenAIAgentsIntegration(Integration):
82
79
- A Model instance is created at the start of the loop by calling the `Runner._get_model()`. We patch the Model instance using `patches._get_model()`.
83
80
- Available tools are also deteremined at the start of the loop, with `Runner._get_all_tools()`. We patch Tool instances by iterating through the returned tools in `patches._get_all_tools()`.
84
81
- In each loop iteration, `run_single_turn()` or `run_single_turn_streamed()` is responsible for calling the Responses API, patched with `patches._run_single_turn()` and `patches._run_single_turn_streamed()`.
85
-
4. On loop termination, `RunImpl.execute_final_output()` is called. The function is patched with `patched_execute_final_output()`.
82
+
4. On loop termination, `RunImpl.execute_final_output()` is called. The function is patched with `patches._execute_final_output()`.
86
83
87
84
Local tools are run based on the return value from the Responses API as a post-API call step in the above loop.
88
85
Hosted MCP Tools are run as part of the Responses API call, and involve OpenAI reaching out to an external MCP server.
0 commit comments