Labels: bug, live-api
Description
Problem
When using the Live API (runner.run_live()) with a non-Vertex AI backend (GOOGLE_GENAI_USE_VERTEXAI=FALSE), session resumption always crashes on reconnect. This makes it impossible to use Gemini 3.1 Flash Live Preview (gemini-3.1-flash-live-preview) with reliable session resumption, since that model is only available on the direct Gemini API — not on Vertex AI.
Root Cause
In google/adk/flows/llm_flows/base_llm_flow.py, the ConnectionClosed exception handler unconditionally sets transparent=True when reconnecting with a session resumption handle (around line 517 in ADK 1.25.1):
# base_llm_flow.py — ConnectionClosed handler
session_resumption_config = types.SessionResumptionConfig(
handle=invocation_context.live_session_resumption_handle,
transparent=True, # <— always set to True
)
However, in google/adk/models/google_llm.py (around lines 448-451), there is a guard that raises a ValueError when transparent=True is used with a non-Vertex AI backend:
if (session_resumption_config and session_resumption_config.transparent
and self._api_backend == GoogleLLMVariant.GEMINI_API):
raise ValueError(
"Transparent session resumption is only supported with Vertex AI backend"
)
This creates a deadlock:
- ADK always sets
transparent=True on reconnect
- Non-Vertex AI backends always reject
transparent=True
- Therefore, session resumption always fails on non-Vertex AI
Why This Matters
|
Direct Gemini API |
Vertex AI |
gemini-3.1-flash-live-preview |
Available |
Not available |
| Transparent session resumption |
Rejected (ValueError) |
Supported |
Users who want to use Gemini 3.1 Flash Live (only available on Direct Gemini API) cannot have working session resumption, because ADK forces transparent=True which is rejected on that backend.
Environment
- ADK version: 1.25.1
- google-genai SDK: 1.59.0
- Backend:
GOOGLE_GENAI_USE_VERTEXAI=FALSE
- Model:
gemini-3.1-flash-live-preview
- OS: Linux / Windows
Expected Behavior
Session resumption should work on non-Vertex AI backends, either by:
- Setting
transparent=False (non-transparent resumption) when the backend is GEMINI_API, or
- Making
transparent configurable by the caller rather than hardcoded to True, or
- Making Gemini 3.1 Flash Live available on Vertex AI
Steps to Reproduce
- Set
GOOGLE_GENAI_USE_VERTEXAI=FALSE
- Use
runner.run_live() with gemini-3.1-flash-live-preview
- Configure
SessionResumptionConfig with a handle
- Wait for the server to send a
GoAway or for the connection to drop
- ADK attempts to reconnect → sets
transparent=True → ValueError is raised → session dies
Workaround Attempted
Setting transparent=False manually on initial connection does not help because ADK's internal ConnectionClosed handler overrides it to True on every reconnect attempt.
Labels:
bug,live-apiDescription
Problem
When using the Live API (
runner.run_live()) with a non-Vertex AI backend (GOOGLE_GENAI_USE_VERTEXAI=FALSE), session resumption always crashes on reconnect. This makes it impossible to use Gemini 3.1 Flash Live Preview (gemini-3.1-flash-live-preview) with reliable session resumption, since that model is only available on the direct Gemini API — not on Vertex AI.Root Cause
In
google/adk/flows/llm_flows/base_llm_flow.py, theConnectionClosedexception handler unconditionally setstransparent=Truewhen reconnecting with a session resumption handle (around line 517 in ADK 1.25.1):However, in
google/adk/models/google_llm.py(around lines 448-451), there is a guard that raises aValueErrorwhentransparent=Trueis used with a non-Vertex AI backend:This creates a deadlock:
transparent=Trueon reconnecttransparent=TrueWhy This Matters
gemini-3.1-flash-live-previewUsers who want to use Gemini 3.1 Flash Live (only available on Direct Gemini API) cannot have working session resumption, because ADK forces
transparent=Truewhich is rejected on that backend.Environment
GOOGLE_GENAI_USE_VERTEXAI=FALSEgemini-3.1-flash-live-previewExpected Behavior
Session resumption should work on non-Vertex AI backends, either by:
transparent=False(non-transparent resumption) when the backend isGEMINI_API, ortransparentconfigurable by the caller rather than hardcoded toTrue, orSteps to Reproduce
GOOGLE_GENAI_USE_VERTEXAI=FALSErunner.run_live()withgemini-3.1-flash-live-previewSessionResumptionConfigwith a handleGoAwayor for the connection to droptransparent=True→ValueErroris raised → session diesWorkaround Attempted
Setting
transparent=Falsemanually on initial connection does not help because ADK's internalConnectionClosedhandler overrides it toTrueon every reconnect attempt.