Skip to content

Bug: run_live() forces session_resumption.transparent=True on reconnect, breaking Gemini Developer API session resumption #5771

@smetanokr

Description

@smetanokr

Summary

google-adk live reconnect logic appears to unconditionally force session_resumption.transparent = True when reconnecting with a saved session resumption handle.

This breaks Gemini Developer API live sessions, because Gemini Developer API supports session resumption, but does not support transparent session resumption.

As a result, a valid RunConfig(session_resumption=types.SessionResumptionConfig()) setup for Gemini Developer API fails on reconnect with:

ValueError: Transparent session resumption is only supported for Vertex AI backend. Please use Vertex AI backend.

Expected behavior

If the app enables basic session resumption with:

RunConfig(
    session_resumption=types.SessionResumptionConfig()
)

then ADK should reconnect using the saved handle without forcing transparent mode for Gemini Developer API backends.

Expected behavior:

  • Gemini Developer API live session starts normally
  • resumption handles are received
  • reconnect uses the handle
  • reconnect preserves transparent=None / unset
  • session resumes successfully across the ~10 minute connection limit

Actual behavior

On reconnect, ADK mutates the reconnect config and sets:

llm_request.live_connect_config.session_resumption.transparent = True

That causes reconnect to fail for Gemini Developer API with:

ValueError: Transparent session resumption is only supported for Vertex AI backend. Please use Vertex AI backend.

Relevant implementation detail

This appears to come from the live reconnect path in base_llm_flow.py, which sets transparent=True once a resumption handle exists.

Related implementation:

  • live session resumption implementation commit:
    • 71fbc9275b3d74700ec410cb4155ba0cb18580b7

From that implementation, reconnect logic includes:

if invocation_context.live_session_resumption_handle:
  ...
  llm_request.live_connect_config.session_resumption.handle = (
      invocation_context.live_session_resumption_handle
  )
  llm_request.live_connect_config.session_resumption.transparent = True

Later, Gemini.connect() rejects this for Gemini API backends.

Why this seems incorrect

Gemini Developer API and Gemini Enterprise/Vertex do not have identical support here:

  • Gemini Developer API: supports session resumption
  • Gemini Developer API: does not support transparent session resumption
  • Enterprise/Vertex: supports transparent session resumption

ADK seems to assume that reconnect should always use transparent mode, which is too aggressive for Gemini Developer API.

Minimal reproduction

Environment:

  • google-adk: 1.34.0
  • Python: 3.14
  • Live model on Gemini Developer API
  • Offline models on Gemini Enterprise/Vertex (not directly relevant to bug)

Live agent:

from google.adk.agents import Agent
from google.adk.models import Gemini

agent = Agent(
    name="live_agent",
    model=Gemini(model="gemini-3.1-flash-live-preview"),
    instruction="You are a helpful live assistant.",
)

Run config:

from google.adk.agents import RunConfig
from google.genai import types

run_config = RunConfig(
    input_audio_transcription=types.AudioTranscriptionConfig(),
    output_audio_transcription=types.AudioTranscriptionConfig(),
    session_resumption=types.SessionResumptionConfig(),
)

Then run through Runner.run_live(...) and wait for a reconnect path or trigger a reconnect after a resumption handle has been issued.

Error

ValueError: Transparent session resumption is only supported for Vertex AI backend. Please use Vertex AI backend.

Suggested fix

One of these would resolve it cleanly:

  1. Preserve the original SessionResumptionConfig.transparent value on reconnect instead of overwriting it.
  2. Only force transparent=True when backend is Enterprise/Vertex.
  3. Add a public reconnect policy/config option so applications can opt out of forced transparent resumption.

Workaround

We worked around this application-side by wrapping Gemini.connect() and clearing session_resumption.transparent for Gemini Developer API reconnects while preserving the resumption handle.

That suggests the underlying session-resumption flow is otherwise valid; the incompatible part is specifically the forced transparent mode.

Metadata

Metadata

Assignees

Labels

live[Component] This issue is related to live, voice and video chat

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions