-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
live[Component] This issue is related to live, voice and video chat[Component] This issue is related to live, voice and video chat
Description
Environment
- ADK Version: 1.22.1 (also affects 1.20.x)
- Python: 3.11+
- Endpoint: /run_live WebSocket
- Modalities: ["AUDIO"] (voice mode)
Description
When using /run_live for voice interactions, FunctionResponse events containing state_delta are buffered during transcription and never yielded to WebSocket clients. The state is correctly saved to session storage, but clients cannot receive real-time state updates from tools.
Reproduction
- Create a tool that sets state_delta:
async def ui_action(action: str, tool_context: ToolContext) -> dict:
tool_context.state["myAction"] = {"type": action}
return {"status": "success"}- Connect to /run_live with audio modality
- Speak a command that triggers the tool
- Observe WebSocket messages
Expected
WebSocket receives FunctionResponse event with state_delta:
{"actions": {"stateDelta": {"myAction": {"type": "..."}}}, ...}Actual
WebSocket only receives events with empty stateDelta:
{"actions": {"stateDelta": {}}, ...}Backend logs confirm state_delta was set:
DEBUG: Appending buffered event: Event(..., state_delta={'myAction': {...}})
Root Cause
runners.py lines 753-757:
if is_transcribing and _is_tool_call_or_response(event):
buffered_events.append(event)
continue # Skips yield!Lines 780-785 append buffered events to session but don't yield them:
for buffered_event in buffered_events:
await self.session_service.append_event(session, buffered_event)
# Missing: yield buffered_eventSuggested Fix
Add yield after appending buffered events (after line 784):
for buffered_event in buffered_events:
await self.session_service.append_event(session, buffered_event)
yield buffered_event # Add this lineWorkaround
Poll session state via GET /apps/{app}/users/{user}/sessions/{session} on turnComplete.
Metadata
Metadata
Assignees
Labels
live[Component] This issue is related to live, voice and video chat[Component] This issue is related to live, voice and video chat