Skip to content

feat(live): filter internal _adk_live artifact parts from live session history - #7346

Merged
copybara-service[bot] merged 1 commit into
mainfrom
copybara/990462563
Oct 7, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
copybara/990462563

Conversation

@copybara-service

Copy link
Copy Markdown

feat(live): filter internal _adk_live artifact parts from live session history

When RunConfig.save_live_blob=True is enabled, live sessions persist realtime
audio, image, and video blobs to BaseArtifactService and record internal
artifact://.../_adk_live/... FileData references (including single-frame
media files and multi-frame application/zip archives) on session events.
Those internal artifact:// URIs cannot be resolved by the Gemini Live API's
send_client_content endpoint when session history is replayed on reconnect or
agent transfer.

This change adds is_adk_live_artifact_part() in utils/content_utils.py and
updates filter_audio_parts() (used by GeminiLlmConnection.send_history())
to strip internal _adk_live artifact FileData parts while preserving text,
inline media blobs, and external gs:// / https:// FileData parts.

Testing Plan:

  • Added unit tests in tests/unittests/utils/test_content_utils.py covering
    is_adk_live_artifact_part() (multi-frame .zip, single-frame .jpeg,
    parameterized/uppercase MIME strings, None fields, external gs:// URIs,
    and inline blobs) and filter_audio_parts().
  • Added test_send_history_filters_out_adk_live_artifact_parts in
    tests/unittests/models/test_gemini_llm_connection.py.

`GeminiLlmConnection.send_history()` replays session history to a new Live
connection on reconnect and agent transfer. It already dropped audio, which is
transcribed and is not supported by the Live API in client content turns. It
now also drops internal `_adk_live` artifact references (`artifact://` URIs
under `_adk_live/`, of any MIME type). `save_live_blob` writes them to the
session, and the model cannot resolve them.

All other parts are replayed as before, including inline image and video and
user-supplied file references such as `gs://` images. The public
`filter_audio_parts()` is unchanged; `send_history()` uses a new private helper.

PiperOrigin-RevId: 994729487
@copybara-service
copybara-service Bot merged commit f03d23d into main Oct 7, 2026
16 of 20 checks passed
@copybara-service
copybara-service Bot deleted the copybara/990462563 branch October 7, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant