Skip to content

Commit de0c79c

Browse files
committed
fix: superfluous patch for run_sync() as it is already handled within run()
1 parent 8f41ec9 commit de0c79c

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

sentry_sdk/integrations/pydantic_ai/patches/agent_run.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -139,29 +139,6 @@ async def wrapper(self, *args, **kwargs):
139139
return wrapper
140140

141141

142-
def _create_run_sync_wrapper(original_func):
143-
# type: (Callable[..., Any]) -> Callable[..., Any]
144-
"""
145-
Wraps the Agent.run_sync method - no span needed as it delegates to run().
146-
147-
Note: run_sync just calls self.run() via run_until_complete, so the
148-
invoke_agent span will be created by the run() wrapper.
149-
"""
150-
151-
@wraps(original_func)
152-
def wrapper(self, *args, **kwargs):
153-
# type: (Any, *Any, **Any) -> Any
154-
# Just call the original function - it will call run() which has the instrumentation
155-
try:
156-
result = original_func(self, *args, **kwargs)
157-
return result
158-
except Exception as exc:
159-
_capture_exception(exc)
160-
raise exc from None
161-
162-
return wrapper
163-
164-
165142
def _create_streaming_wrapper(original_func):
166143
# type: (Callable[..., Any]) -> Callable[..., Any]
167144
"""
@@ -226,13 +203,11 @@ def _patch_agent_run():
226203

227204
# Store original methods
228205
original_run = Agent.run
229-
original_run_sync = Agent.run_sync
230206
original_run_stream = Agent.run_stream
231207
original_run_stream_events = Agent.run_stream_events
232208

233209
# Wrap and apply patches for non-streaming methods
234210
Agent.run = _create_run_wrapper(original_run, is_streaming=False) # type: ignore
235-
Agent.run_sync = _create_run_sync_wrapper(original_run_sync) # type: ignore
236211

237212
# Wrap and apply patches for streaming methods
238213
Agent.run_stream = _create_streaming_wrapper(original_run_stream) # type: ignore

0 commit comments

Comments
 (0)