Skip to content

Build and run agents you can see, understand and trust.

fix(realtime): request a response after a caller-committed turn (#2559)

DavdGaof0b412902e73
diff --git a/src/agentscope/agent/_realtime/_agent.py b/src/agentscope/agent/_realtime/_agent.py
index 4b8b1a6c5..7a1531149 100644
--- a/src/agentscope/agent/_realtime/_agent.py
+++ b/src/agentscope/agent/_realtime/_agent.py
@@ -519,6 +519,9 @@ class RealtimeAgent:
self._metrics.user_speech_end_at = now
await self.model.commit_turn()
self._metrics.turn_committed_at = time.monotonic()
+ # With turn detection off nothing answers a committed turn
+ # by itself; providers that reply on commit make this a no-op.
+ await self.model.request_response()
if not pushed:
await self.model.push_audio(pcm)
diff --git a/tests/realtime_agent_test.py b/tests/realtime_agent_test.py
index a92fd5d33..8a6ab52d7 100644
--- a/tests/realtime_agent_test.py
+++ b/tests/realtime_agent_test.py
@@ -407,6 +407,7 @@ class RealtimeAgentTest(IsolatedAsyncioTestCase):
"connect(session=1,td_off=True)",
"push_audio",
"commit_turn",
+ "request_response",
"push_audio",
"push_audio",
"close",