diff --git a/sentry_sdk/integrations/__init__.py b/sentry_sdk/integrations/__init__.py index 4c286c87fe..b340dec36e 100644 --- a/sentry_sdk/integrations/__init__.py +++ b/sentry_sdk/integrations/__init__.py @@ -176,6 +176,8 @@ def iter_default_integrations(with_auto_enabling_integrations): _INTEGRATION_DEACTIVATES = { "langchain": {"openai", "anthropic"}, + "openai_agents": {"openai"}, + "pydantic_ai": {"openai", "anthropic"}, } diff --git a/tests/test_ai_integration_deactivation.py b/tests/test_ai_integration_deactivation.py index 71ac4f70a9..dc8aef6be8 100644 --- a/tests/test_ai_integration_deactivation.py +++ b/tests/test_ai_integration_deactivation.py @@ -26,8 +26,29 @@ has_anthropic = False +try: + from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration + + has_openai_agents = True +except Exception: + has_openai_agents = False + +try: + from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration + + has_pydantic_ai = True +except Exception: + has_pydantic_ai = False + + pytestmark = pytest.mark.skipif( - not (has_langchain and has_openai and has_anthropic), + not ( + has_langchain + and has_openai + and has_anthropic + and has_openai_agents + and has_pydantic_ai + ), reason="Requires langchain, openai, and anthropic packages to be installed", ) @@ -36,6 +57,11 @@ def test_integration_deactivates_map_exists(): assert "langchain" in _INTEGRATION_DEACTIVATES assert "openai" in _INTEGRATION_DEACTIVATES["langchain"] assert "anthropic" in _INTEGRATION_DEACTIVATES["langchain"] + assert "openai_agents" in _INTEGRATION_DEACTIVATES + assert "openai" in _INTEGRATION_DEACTIVATES["openai_agents"] + assert "pydantic_ai" in _INTEGRATION_DEACTIVATES + assert "openai" in _INTEGRATION_DEACTIVATES["pydantic_ai"] + assert "anthropic" in _INTEGRATION_DEACTIVATES["pydantic_ai"] def test_langchain_auto_deactivates_openai_and_anthropic( @@ -104,13 +130,17 @@ def test_user_can_override_with_both_explicit_integrations( assert AnthropicIntegration in integration_types -def test_disabling_langchain_allows_openai_and_anthropic( +def test_disabling_integrations_allows_openai_and_anthropic( sentry_init, reset_integrations ): sentry_init( default_integrations=False, auto_enabling_integrations=True, - disabled_integrations=[LangchainIntegration], + disabled_integrations=[ + LangchainIntegration, + OpenAIAgentsIntegration, + PydanticAIIntegration, + ], ) client = get_client()