Skip to content

Commit 269802b

Browse files
committed
Bring back handoff span 2
1 parent 5c59668 commit 269802b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from sentry_sdk.integrations import DidNotEnable
2+
3+
from .spans import handoff_span
4+
5+
6+
try:
7+
import agents
8+
except ImportError:
9+
raise DidNotEnable("OpenAI Agents not installed")
10+
11+
12+
class SentryRunHooks(agents.RunHooks): # type: ignore[misc]
13+
async def on_handoff(
14+
self,
15+
context: agents.RunContextWrapper,
16+
from_agent: agents.Agent,
17+
to_agent: agents.Agent,
18+
) -> None:
19+
handoff_span(context, from_agent, to_agent)

sentry_sdk/integrations/openai_agents/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ def _wrap_hooks(hooks):
176176
enable our SentryRunHooks or if the users has given custom RunHooks wrap
177177
them so the Sentry hooks and the users hooks are both called
178178
"""
179-
import ipdb
180-
181-
ipdb.set_trace()
182179
from .run_hooks import SentryRunHooks
183180

184181
sentry_hooks = SentryRunHooks()

0 commit comments

Comments
 (0)