diff --git a/sentry_sdk/integrations/openai_agents/patches/models.py b/sentry_sdk/integrations/openai_agents/patches/models.py index 6b5dceef97..58f0f3b199 100644 --- a/sentry_sdk/integrations/openai_agents/patches/models.py +++ b/sentry_sdk/integrations/openai_agents/patches/models.py @@ -133,8 +133,6 @@ async def wrapped_get_response(*args: "Any", **kwargs: "Any") -> "Any": @wraps(original_stream_response) async def wrapped_stream_response(*args: "Any", **kwargs: "Any") -> "Any": - # Uses explicit try/finally instead of context manager to ensure cleanup - # even if the consumer abandons the stream (GeneratorExit). span_kwargs = dict(kwargs) if len(args) > 0: span_kwargs["system_instructions"] = args[0]