22
33from sentry_sdk .integrations import DidNotEnable
44from sentry_sdk .tracing_utils import set_span_errored
5- from ..spans import invoke_agent_span , update_invoke_agent_span , handoff_span
5+ from ..spans import (
6+ invoke_agent_span ,
7+ update_invoke_agent_span ,
8+ end_invoke_agent_span ,
9+ handoff_span ,
10+ )
611from ..utils import _capture_exception , _record_exception_on_span
712
813from typing import TYPE_CHECKING
@@ -78,7 +83,7 @@ async def patched_run_single_turn(cls, *args, **kwargs):
7883 if _has_active_agent_span (context_wrapper ):
7984 current_agent = _get_current_agent (context_wrapper )
8085 if current_agent and current_agent != agent :
81- _end_invoke_agent_span (context_wrapper , current_agent )
86+ end_invoke_agent_span (context_wrapper , current_agent )
8287
8388 span = _start_invoke_agent_span (context_wrapper , agent , kwargs )
8489
@@ -88,7 +93,7 @@ async def patched_run_single_turn(cls, *args, **kwargs):
8893 except Exception as exc :
8994 if span is not None and span .timestamp is None :
9095 _record_exception_on_span (span , exc )
91- _end_invoke_agent_span (context_wrapper , agent )
96+ end_invoke_agent_span (context_wrapper , agent )
9297
9398 _capture_exception (exc )
9499 raise exc from None
0 commit comments