Skip to content

Commit 8a45abf

Browse files
fix(pydantic-ai): Stop setting tokens on Invoke Agent spans
1 parent 0af4a8b commit 8a45abf

1 file changed

Lines changed: 0 additions & 11 deletions

File tree

sentry_sdk/integrations/pydantic_ai/spans/invoke_agent.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from .utils import (
2020
_serialize_binary_content_item,
2121
_serialize_image_url_item,
22-
_set_usage_data,
2322
)
2423

2524
if TYPE_CHECKING:
@@ -150,16 +149,6 @@ def update_invoke_agent_span(span: "sentry_sdk.tracing.Span", result: "Any") ->
150149
span, SPANDATA.GEN_AI_RESPONSE_TEXT, str(output), unpack=False
151150
)
152151

153-
# Set token usage data if available
154-
if hasattr(result, "usage") and callable(result.usage):
155-
try:
156-
usage = result.usage()
157-
if usage:
158-
_set_usage_data(span, usage)
159-
except Exception:
160-
# If usage() call fails, continue without setting usage data
161-
pass
162-
163152
# Set model name from response if available
164153
if hasattr(result, "response"):
165154
try:

0 commit comments

Comments
 (0)