Bug Description
When using LiveKit Agents with the Google Gemini Realtime plugin, the session consistently crashes with a ConnectionClosedError (1007) due to an invalid JSON payload being sent to the Gemini API.
The Gemini Realtime service rejects the incoming payload, reporting an unknown field "scheduling" inside the tool_response.function_responses[0] object.
2025-11-10 17:05:53,355 - DEBUG livekit.agents - executing tool {"function": "get_application_status", "arguments": "{\"mobileNo\": \"1234\", \"application_no\": \"1234\"}"}
2025-11-10 17:05:56,288 - ERROR livekit.plugins.google - error in receive task:
received 1007 (invalid frame payload data)
Invalid JSON payload received.
Unknown name "scheduling" at 'tool_response.function_responses[0]': Cannot find field.
Traceback (most recent call last):
File "/home/tesla/work/hdfc_sky/.venv/lib/python3.11/site-packages/livekit/plugins/google/realtime/realtime_api.py", line 779, in _recv_task
async for response in session.receive():
File "/home/tesla/work/hdfc_sky/.venv/lib/python3.11/site-packages/google/genai/live.py", line 448, in receive
while result := await self._receive():
...
websockets.exceptions.ConnectionClosedError:
received 1007 (invalid frame payload data)
Invalid JSON payload received.
Unknown name "scheduling" at 'tool_response.function_responses[0]': Cannot find field.
Expected Behavior
The livekit.plugins.google module should send payloads that conform exactly to Gemini’s expected schema. Gemini should not close the connection if LiveKit’s payload structure is valid.
Reproduction Steps
1. Use LiveKit Agents with Google Gemini Realtime plugin.
2. Add any tool (e.g., get_application_status) returning a JSON dict.
3. Start a realtime session and invoke the tool.
4. Observe Gemini disconnects with Invalid JSON payload referring to "scheduling".
Operating System
Fedora Linux 42 (Workstation Edition) / Ubuntu 24.04
Models Used
No response
Package Versions
Python==3.11.13
livekit==1.0.18
livekit-agents==1.2.17
livekit-plugins-google==1.2.17
google-genai==1.49.0
Vertex Model==gemini-live-2.5-flash-preview-native-audio-09-2025
Session/Room/Call IDs
No response
Proposed Solution
Additional Context
No response
Screenshots and Recordings
No response
Bug Description
When using LiveKit Agents with the Google Gemini Realtime plugin, the session consistently crashes with a ConnectionClosedError (1007) due to an invalid JSON payload being sent to the Gemini API.
The Gemini Realtime service rejects the incoming payload, reporting an unknown field "scheduling" inside the tool_response.function_responses[0] object.
Expected Behavior
The livekit.plugins.google module should send payloads that conform exactly to Gemini’s expected schema. Gemini should not close the connection if LiveKit’s payload structure is valid.
Reproduction Steps
1. Use LiveKit Agents with Google Gemini Realtime plugin. 2. Add any tool (e.g., get_application_status) returning a JSON dict. 3. Start a realtime session and invoke the tool. 4. Observe Gemini disconnects with Invalid JSON payload referring to "scheduling".Operating System
Fedora Linux 42 (Workstation Edition) / Ubuntu 24.04
Models Used
No response
Package Versions
Session/Room/Call IDs
No response
Proposed Solution
Additional Context
No response
Screenshots and Recordings
No response