File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
sentry_sdk/integrations/openai_agents/patches Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 1- import asyncio
2-
31from functools import wraps
42
53import sentry_sdk
1614def _create_run_wrapper (original_func ):
1715 # type: (Callable[..., Any]) -> Callable[..., Any]
1816 """
19- Wraps the agents.Runner.run* methods to create a root span for the agent workflow runs.
17+ Wraps the agents.Runner.run methods to create a root span for the agent workflow runs.
2018 """
21- is_async = asyncio .iscoroutinefunction (original_func )
2219
2320 @wraps (original_func )
24- async def async_wrapper (* args , ** kwargs ):
21+ async def wrapper (* args , ** kwargs ):
2522 # type: (*Any, **Any) -> Any
2623 agent = args [0 ]
2724 with agent_workflow_span (agent ):
@@ -39,10 +36,4 @@ async def async_wrapper(*args, **kwargs):
3936
4037 raise exc from None
4138
42- @wraps (original_func )
43- def sync_wrapper (* args , ** kwargs ):
44- # type: (*Any, **Any) -> Any
45- # The sync version (.run_sync()) is just a wrapper around the async version (.run())
46- return original_func (* args , ** kwargs )
47-
48- return async_wrapper if is_async else sync_wrapper
39+ return wrapper
You can’t perform that action at this time.
0 commit comments