-
Notifications
You must be signed in to change notification settings - Fork 3.2k
ADK run_live() incompatible with gemini-3.1-flash-live-preview (5 breaking issues) #5075
Description
Summary
ADK's run_live() has 5 incompatibilities with gemini-3.1-flash-live-preview. This issue documents all of them for reference. PR #5076 fixes issues 1-4. Issue 5 is a model limitation.
Tested on ADK 1.28.0, google-genai SDK, Google AI Studio.
Issue 1: send_realtime_input(media=) deprecated — audio rejected
GeminiLlmConnection.send_realtime() uses media= which produces the deprecated mediaChunks wire format. 3.1 rejects it:
Error: 1007 — "realtime_input.media_chunks is deprecated. Use audio, video, or text instead."
Fix: Use audio= parameter instead (backward compatible with 2.5).
Issue 2: LiveClientContent rejected for mid-conversation text
GeminiLlmConnection.send_content() wraps text in LiveClientContent. 3.1 rejects this for anything except initial history.
Error: 1007 — "Request contains an invalid argument"
Fix: Route text through send_realtime_input(text=...) for 3.1 models. Use model_version check.
Issue 3: LiveClientToolResponse deprecated
send_content() uses session.send(LiveClientToolResponse(...)) which is deprecated.
Fix: Use send_tool_response(function_responses=...) — the current API (backward compatible).
Issue 4: history_config required for session history
3.1 requires HistoryConfig(initial_history_in_client_content=True) in LiveConnectConfig. Without it, conversation history sent via send_history() is ignored.
Fix: Inject history_config in Gemini.connect() when model is 3.1 and not already set.
Issue 5: Unsupported LiveConnectConfig fields (model limitation)
The following fields cause connection errors on 3.1:
- enable_affective_dialog → 1011 Internal error encountered
- context_window_compression → 1007 Request contains an invalid argument
- proactivity → 1007 Unknown name 'proactivity' at 'setup'
These are model API limitations. Users should avoid setting these fields for 3.1 models. Consider adding documentation or a model capability registry.
Workaround
We monkey-patch GeminiLlmConnection.send_realtime, send_content, and Gemini.connect at runtime. This is production-tested with real phone calls but fragile across ADK upgrades.
Related
- PR feat: add Gemini 3.1 Flash Live support for run_live() #5076 fixes issues 1-4
- Original report: ADK does not support the newest gemini-3.1-flash-live-preview #5018