Bug Description
The @livekit/agents-plugin-google Realtime plugin silently ignores empty server content from Gemini, causing the agent to enter speaking state with no audio output. This is the JS equivalent of the bug fixed in the Python SDK by livekit/agents#4249.
Current Behavior
In realtime_api.ts (line ~1132), when Gemini returns a response with no meaningful server content, the plugin silently drops it:
if (!hasServerContent) {
response.serverContent = undefined;
if (LK_GOOGLE_DEBUG) {
this.#logger.debug('ignoring empty server content');
}
}
When Gemini sends turnComplete with empty content (a known server-side bug), the generation is marked done but no audio was produced — the agent "speaks" silence.
Expected Behavior
Match the Python SDK fix (PR #4249): raise an APIStatusError on empty responses so the SDK's retry/fallback mechanisms can recover, rather than silently accepting a failed turn.
Impact
In production phone ordering calls using gemini-3.1-flash-live-preview, we observe ~50% of deployed calls experiencing at least one silent stall. The agent enters speaking state but produces no audio. The WebSocket stays open, no error events fire. Our application-level stall recovery (realtime text nudge after 8s) catches most of these, but the plugin should handle this at the source.
Environment
@livekit/agents-plugin-google: 1.3.4 (also verified in 1.4.0 — still present)
@livekit/agents: 1.3.4
- Model:
gemini-3.1-flash-live-preview
- Runtime: Node.js on LiveKit Cloud (us-east)
Related Issues
Bug Description
The
@livekit/agents-plugin-googleRealtime plugin silently ignores empty server content from Gemini, causing the agent to enterspeakingstate with no audio output. This is the JS equivalent of the bug fixed in the Python SDK by livekit/agents#4249.Current Behavior
In
realtime_api.ts(line ~1132), when Gemini returns a response with no meaningful server content, the plugin silently drops it:When Gemini sends
turnCompletewith empty content (a known server-side bug), the generation is marked done but no audio was produced — the agent "speaks" silence.Expected Behavior
Match the Python SDK fix (PR #4249): raise an
APIStatusErroron empty responses so the SDK's retry/fallback mechanisms can recover, rather than silently accepting a failed turn.Impact
In production phone ordering calls using
gemini-3.1-flash-live-preview, we observe ~50% of deployed calls experiencing at least one silent stall. The agent entersspeakingstate but produces no audio. The WebSocket stays open, no error events fire. Our application-level stall recovery (realtime text nudge after 8s) catches most of these, but the plugin should handle this at the source.Environment
@livekit/agents-plugin-google: 1.3.4 (also verified in 1.4.0 — still present)@livekit/agents: 1.3.4gemini-3.1-flash-live-previewRelated Issues
turnCompletein JS SDK