feat: Implement Live Session Resumption

Previous implementation doesn't pass the actual handle to server. Now we cache the handle and pass it over when reconnection happens.

To enable:
    run_config = RunConfig(
        session_resumption=types.SessionResumptionConfig(transparent=True)
    )

PiperOrigin-RevId: 791308462
This commit is contained in:
Hangfei Lin
2025-08-05 11:50:54 -07:00
committed by Copybara-Service
parent 423542a43f
commit 71fbc9275b
9 changed files with 333 additions and 76 deletions
@@ -121,7 +121,9 @@ def stop_streaming(function_name: str):
root_agent = Agent(
model="gemini-live-2.5-flash-preview",
# find supported models here: https://google.github.io/adk-docs/get-started/streaming/quickstart-streaming/
model="gemini-2.0-flash-live-preview-04-09", # for Vertex project
# model="gemini-live-2.5-flash-preview", # for AI studio key
name="video_streaming_agent",
instruction="""
You are a monitoring agent. You can do video monitoring and stock price monitoring