From 104fe1de27669f61f5fafb9ddc6e019bab03cd67 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Fri, 21 Nov 2025 10:49:04 +0100 Subject: [PATCH 1/2] Fix openai-agents import --- sentry_sdk/integrations/openai_agents/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sentry_sdk/integrations/openai_agents/__init__.py b/sentry_sdk/integrations/openai_agents/__init__.py index 7e2dee0f66..fe135b4f4a 100644 --- a/sentry_sdk/integrations/openai_agents/__init__.py +++ b/sentry_sdk/integrations/openai_agents/__init__.py @@ -9,7 +9,13 @@ ) try: + # "agents" is too generic. If someone has an agents.py file on their project, + # or another package that's importable via "agents", no ImportError would not + # be thrown and the integration would enable itself even if openai-agents is + # not installed. That's why we're adding the second, more specific import + # after it, even if we don't use it. import agents + from agents.run import DEFAULT_AGENT_RUNNER except ImportError: raise DidNotEnable("OpenAI Agents not installed") From ce885731104fd6f34a9a2a1d0cdbf20e2cbe4487 Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Fri, 21 Nov 2025 10:53:36 +0100 Subject: [PATCH 2/2] typo --- sentry_sdk/integrations/openai_agents/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/openai_agents/__init__.py b/sentry_sdk/integrations/openai_agents/__init__.py index fe135b4f4a..1f138b5e65 100644 --- a/sentry_sdk/integrations/openai_agents/__init__.py +++ b/sentry_sdk/integrations/openai_agents/__init__.py @@ -9,7 +9,7 @@ ) try: - # "agents" is too generic. If someone has an agents.py file on their project, + # "agents" is too generic. If someone has an agents.py file in their project # or another package that's importable via "agents", no ImportError would not # be thrown and the integration would enable itself even if openai-agents is # not installed. That's why we're adding the second, more specific import