Skip to content

Commit 2dc0251

Browse files
.
1 parent 8fecde2 commit 2dc0251

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sentry_sdk/integrations/openai_agents/patches/agent_run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def _run_single_turn(
114114
return await original_run_single_turn(*args, **kwargs)
115115

116116
try:
117-
return await original_run_single_turn(*args, **kwargs)
117+
result = await original_run_single_turn(*args, **kwargs)
118118
except Exception:
119119
exc_info = sys.exc_info()
120120
with capture_internal_exceptions():
@@ -124,6 +124,8 @@ async def _run_single_turn(
124124
delattr(context_wrapper, "_sentry_agent_span")
125125
reraise(*exc_info)
126126

127+
return result
128+
127129

128130
async def _run_single_turn_streamed(
129131
original_run_single_turn_streamed: "Callable[..., Awaitable[SingleStepResult]]",
@@ -193,13 +195,15 @@ async def _run_single_turn_streamed(
193195
agent=agent,
194196
):
195197
try:
196-
return await original_run_single_turn_streamed(*args, **kwargs)
198+
result = await original_run_single_turn_streamed(*args, **kwargs)
197199
except Exception:
198200
exc_info = sys.exc_info()
199201
with capture_internal_exceptions():
200202
_close_streaming_workflow_span(agent)
201203
reraise(*exc_info)
202204

205+
return result
206+
203207

204208
async def _execute_handoffs(
205209
original_execute_handoffs: "Callable[..., SingleStepResult]",

0 commit comments

Comments
 (0)