Skip to content

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

Closed

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.

Activity

  1. added
    live[Component] This issue is related to live, voice and video chat
    on May 21, 2026
  2. added theissue type on May 21, 2026
  3. llalitkumarrr commented on May 22, 2026

    @llalitkumarrr
    Collaborator

    Hello @smetanokr ,

    Just to clarify, were you able to resolve your issue with the workaround you shared? Also, could you please take a look at the associated PR and let us know if it helps?

  4. added
    request clarification[Status] The maintainer need clarification or more information from the author
    on May 22, 2026
  5. smetanokr commented on May 22, 2026

    @smetanokr
    Author

    Hello @smetanokr ,

    Just to clarify, were you able to resolve your issue with the workaround you shared? Also, could you please take a look at the associated PR and let us know if it helps?

    yes , i am able to workaround it by creating custom LiveGemini class:

    """Custom Gemini wrappers for explicit backend selection."""
    
    import contextlib
    from functools import cached_property
    
    from google import genai
    from google.adk.models import Gemini
    from google.genai import types
    
    
    class LiveGemini(Gemini):
        @cached_property
        def api_client(self):
            return genai.Client(enterprise=False)
    
        @cached_property
        def _live_api_client(self):
            return genai.Client(enterprise=False)
    
        @contextlib.asynccontextmanager
        async def connect(self, llm_request):
            if (
                llm_request.live_connect_config
                and llm_request.live_connect_config.session_resumption
            ):
                llm_request.live_connect_config.session_resumption.transparent = None
    
            async with super().connect(llm_request) as connection:
                yield connection
    

    and then using it as model attribute for Agent

        return Agent(
            name="live_interview_agent",
            model=LiveGemini(model=os.getenv("MODEL_LIVE")),
            instruction=model_prompt.system_instruction,
            generate_content_config=types.GenerateContentConfig(
                thinking_config=types.ThinkingConfig(
                    thinking_level=types.ThinkingLevel.LOW,
                    include_thoughts=True,
                )
            ),
            tools=[
    ....
            ],
        )
    

    ill try to test PR and let you know.

  6. smetanokr commented on May 22, 2026

    @smetanokr
    Author

    Hello @smetanokr ,

    Just to clarify, were you able to resolve your issue with the workaround you shared? Also, could you please take a look at the associated PR and let us know if it helps?

    @llalitkumarrr , i can confirm that with "fix: preserve live session transparency #5773" applied at top of main branch i was able to have 17minutes long session with gemini-3.1-flash-live-preview using google developer api without any error in log

  7. llalitkumarrr commented on May 25, 2026

    @llalitkumarrr
    Collaborator

    Hello @smetanokr ,

    Thank you for your inputs, the PR is currently under review. We appreciate your patience while we review it. Thank you for understanding.

  8. added
    needs review[Status] The PR/issue is awaiting review from the maintainer
    and removed
    request clarification[Status] The maintainer need clarification or more information from the author
    on May 25, 2026
  9. self-assigned this
    on Jun 16, 2026
  10. GWeale commented on Aug 6, 2026

    @GWeale
    Collaborator

    fixed in v2.2.0 by 5ad1942, the live reconnect path now only sets session_resumption.transparent on the vertex backend and only when you left it unset, so developer api sessions reconnect fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

live[Component] This issue is related to live, voice and video chatneeds review[Status] The PR/issue is awaiting review from the maintainer

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions