Skip to content

Commit 7263a77

Browse files
committed
fix: working in feedback
1 parent 48af290 commit 7263a77

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

sentry_sdk/integrations/pydantic_ai/patches/agent_run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
try:
1515
import pydantic_ai
16+
from pydantic_ai.agent import Agent
1617
except ImportError:
1718
raise DidNotEnable("pydantic-ai not installed")
1819

@@ -202,8 +203,6 @@ def _patch_agent_run():
202203
This patches both non-streaming (run, run_sync) and streaming
203204
(run_stream, run_stream_events) methods.
204205
"""
205-
# Import here to avoid circular imports
206-
from pydantic_ai.agent import Agent
207206

208207
# Store original methods
209208
original_run = Agent.run

sentry_sdk/integrations/pydantic_ai/spans/invoke_agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sentry_sdk
22
from sentry_sdk.ai.utils import get_start_span_function, set_data_normalized
33
from sentry_sdk.consts import OP, SPANDATA
4+
from sentry_sdk.utils import safe_serialize
45

56
from ..consts import SPAN_ORIGIN
67
from ..utils import _set_agent_data, _set_model_data, _should_send_prompts
@@ -36,8 +37,6 @@ def invoke_agent_span(user_prompt, agent, model, model_settings):
3637
# Add available tools if present
3738
if agent and hasattr(agent, "_function_toolset"):
3839
try:
39-
from sentry_sdk.utils import safe_serialize
40-
4140
tools = []
4241
# Get tools from the function toolset
4342
if hasattr(agent._function_toolset, "tools"):

0 commit comments

Comments
 (0)