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 run_single_turn_streamed() functions following library refactor (#5451)
`AgentRunner._run_single_turn_streamed()` was moved to `agents.run_internal.run_loop.run_single_turn_streamed()`.
Patch the new function by reusing existing wrapper logic.
Copy file name to clipboardExpand all lines: sentry_sdk/integrations/openai_agents/__init__.py
+26-1Lines changed: 26 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@
7
7
_get_model,
8
8
_get_all_tools,
9
9
_run_single_turn,
10
+
_run_single_turn_streamed,
10
11
_create_run_wrapper,
11
12
_create_run_streamed_wrapper,
12
13
_patch_agent_run,
@@ -78,7 +79,7 @@ class OpenAIAgentsIntegration(Integration):
78
79
3. In a loop, the agent repeatedly calls the Responses API, maintaining a conversation history that includes previous messages and tool results, which is passed to each call.
79
80
- 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()`.
80
81
- 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()`.
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 `patched_run_single_turn_streamed()`.
82
+
- 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()`.
82
83
4. On loop termination, `RunImpl.execute_final_output()` is called. The function is patched with `patched_execute_final_output()`.
83
84
84
85
Local tools are run based on the return value from the Responses API as a post-API call step in the above loop.
0 commit comments