Skip to content

Session resumption crashes on non-Vertex AI backend — blocks usage of Gemini 3.1 Flash Live #5675

@amitanshupanigrahi2704

Description

@amitanshupanigrahi2704

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:

  1. Setting transparent=False (non-transparent resumption) when the backend is GEMINI_API, or
  2. Making transparent configurable by the caller rather than hardcoded to True, or
  3. Making Gemini 3.1 Flash Live available on Vertex AI

Steps to Reproduce

  1. Set GOOGLE_GENAI_USE_VERTEXAI=FALSE
  2. Use runner.run_live() with gemini-3.1-flash-live-preview
  3. Configure SessionResumptionConfig with a handle
  4. Wait for the server to send a GoAway or for the connection to drop
  5. ADK attempts to reconnect → sets transparent=TrueValueError 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.

Metadata

Metadata

Assignees

Labels

live[Component] This issue is related to live, voice and video chatrequest clarification[Status] The maintainer need clarification or more information from the author

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions