Skip to content

Commit 8fecde2

Browse files
cleanup
1 parent 35bd5f7 commit 8fecde2

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

sentry_sdk/integrations/openai_agents/patches/agent_run.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ async def _run_single_turn(
118118
except Exception:
119119
exc_info = sys.exc_info()
120120
with capture_internal_exceptions():
121-
span = getattr(context_wrapper, "_sentry_agent_span", None)
122-
if not span:
123-
return
124-
125121
update_invoke_agent_span(span=span, context=context_wrapper, agent=agent)
126122

127123
span.__exit__(*exc_info)
@@ -231,15 +227,13 @@ async def _execute_handoffs(
231227
if not agent or not context_wrapper or not _has_active_agent_span(context_wrapper):
232228
# Call original method with all parameters
233229
try:
234-
result = await original_execute_handoffs(*args, **kwargs)
230+
return await original_execute_handoffs(*args, **kwargs)
235231
except Exception:
236232
exc_info = sys.exc_info()
237233
with capture_internal_exceptions():
238234
_close_streaming_workflow_span(agent)
239235
reraise(*exc_info)
240236

241-
return result
242-
243237
with _AgentInvocationSpanContext(
244238
context_wrapper=context_wrapper,
245239
agent=agent,

0 commit comments

Comments
 (0)