From 6674c02bfed5d30cef3e1019e9172a72a50b04b2 Mon Sep 17 00:00:00 2001 From: "marcelo.bortolozzo" Date: Mon, 6 Oct 2025 14:52:12 -0300 Subject: [PATCH] fix: adjust realtime handoff import --- src/agents/realtime/handoffs.py | 2 +- tests/realtime/test_realtime_handoffs.py | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/agents/realtime/handoffs.py b/src/agents/realtime/handoffs.py index a3e5151f6..fa84b3a3f 100644 --- a/src/agents/realtime/handoffs.py +++ b/src/agents/realtime/handoffs.py @@ -13,10 +13,10 @@ from ..tracing.spans import SpanError from ..util import _error_tracing, _json from ..util._types import MaybeAwaitable +from . import RealtimeAgent if TYPE_CHECKING: from ..agent import AgentBase - from . import RealtimeAgent # The handoff input type is the type of data passed when the agent is called via a handoff. diff --git a/tests/realtime/test_realtime_handoffs.py b/tests/realtime/test_realtime_handoffs.py index a94c06bb0..7ada3db40 100644 --- a/tests/realtime/test_realtime_handoffs.py +++ b/tests/realtime/test_realtime_handoffs.py @@ -139,14 +139,6 @@ async def is_enabled(ctx, agent): h = realtime_handoff(rt, is_enabled=is_enabled) - # Patch missing symbol in module to satisfy isinstance in closure - import agents.realtime.handoffs as rh - - if not hasattr(rh, "RealtimeAgent"): - from agents.realtime import RealtimeAgent as _RT - - rh.RealtimeAgent = _RT # type: ignore[attr-defined] - from collections.abc import Awaitable from typing import cast as _cast