-
Notifications
You must be signed in to change notification settings - Fork 584
Closed
Description
PydanticAIIntegration fails with pydantic-ai-slim 1.63.0: ToolManager has no attribute '_call_tool'
Description
When using pydantic-ai-slim[openai]==1.63.0 with Sentry's auto-enabled Pydantic AI integration, the SDK fails during import/startup with:
AttributeError: type object 'ToolManager' has no attribute '_call_tool'
The integration patches ToolManager._call_tool in sentry_sdk/integrations/pydantic_ai/patches/tools.py (line 43: original_call_tool = ToolManager._call_tool), but in pydantic-ai-slim 1.63.0 the ToolManager class no longer exposes this attribute (or it was moved/renamed in the slim package).
Environment
- sentry-sdk: 2.53.0 (with
[fastapi]) - pydantic-ai-slim: 1.63.0 with
[openai]extra - Python: 3.11
Expected behavior
The Pydantic AI integration should either:
- Detect that
ToolManager._call_toolis not present and skip the tool-execution patch (e.g. withgetattr(ToolManager, '_call_tool', None)), or - Document compatibility with pydantic-ai-slim and supported versions.
Actual behavior
Any code path that triggers loading of the Pydantic AI integration (e.g. importing an app that uses pydantic-ai) raises AttributeError and prevents startup. For example, pytest collection fails when collecting a test module that does from src.main import app.
Workaround
- Pin pydantic-ai-slim to 1.62.x (e.g.
==1.62.0), with which the integration works, or - Disable the integration:
sentry_sdk.init(..., disabled_integrations=[PydanticAIIntegration])
Related
- PR fix(pydantic-ai): Do not fail on new
ToolManager._call_tool()parameters #5084 (fix for newToolManager._call_tool()parameters in pydantic-ai 1.12.0) fixed signature compatibility but not the case where the attribute is missing entirely.
Reproduction
pip install "sentry-sdk[fastapi]==2.53.0" "pydantic-ai-slim[openai]==1.63.0"- In application code, call
sentry_sdk.init(dsn="...", ...)(integration is auto-enabled when pydantic_ai is installed). - Import a module that uses pydantic_ai (e.g. FastAPI app with agent routes).
- Observe
AttributeError: type object 'ToolManager' has no attribute '_call_tool'during the patch in_patch_tool_execution().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Projects
Status
No status