feat(artifacts): add save_media_frames() for batched media persistence - #7152
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
copybara/982888971
branch
4 times, most recently
from
September 17, 2026 18:29
d2f1377 to
11a9efd
Compare
Introduces `save_media_frames()` on the artifact service layer. It accepts `frames: list[MediaFrame]` -- a batch of media blobs each paired with its capture timestamp -- and persists them as a single artifact, so a stream of realtime video or image frames can be stored in one call instead of one artifact per frame. Implemented across the service hierarchy: - `MediaFrame`: new model pairing a `types.Blob` with its capture timestamp, exported from `google.adk.artifacts`. - `BaseArtifactService.save_media_frames()`: new non-abstract method that raises `NotImplementedError` by default, so existing third-party artifact services keep working without modification. - `InMemoryArtifactService`, `FileArtifactService`, `GcsArtifactService`: concrete implementations. - `_ForwardingArtifactService` and `PerAgentFileArtifactService`: delegate to the wrapped service. This is a storage-layer change with no dependency on the live flow or the cache manager, and it adds no new call sites; the caller that uses it ships separately. It is not quite purely additive: `GcsArtifactService`'s `delete_artifact()` now has media frames to clean up, which it does from the listing it already performs rather than by issuing an additional one. Also documents the new method in the artifact service guide. Testing: - `tests/unittests/artifacts` and `tests/unittests/tools/test_forwarding_artifact_service.py`: 999 passed. - New coverage: round-trip persistence and retrieval per backend, empty-frame handling, timestamp ordering, and `NotImplementedError` from the base class. PiperOrigin-RevId: 982888971
copybara-service
Bot
force-pushed
the
copybara/982888971
branch
from
September 17, 2026 19:37
11a9efd to
759ecb3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(artifacts): add save_media_frames() for batched media persistence
Introduces
save_media_frames()on the artifact service layer. It acceptsframes: list[MediaFrame]-- a batch of media blobs each paired with itscapture timestamp -- and persists them as a single artifact, so a stream of
realtime video or image frames can be stored in one call instead of one
artifact per frame.
Implemented across the service hierarchy:
MediaFrame: new model pairing atypes.Blobwith its capture timestamp,exported from
google.adk.artifacts.BaseArtifactService.save_media_frames(): new non-abstract method thatraises
NotImplementedErrorby default, so existing third-party artifactservices keep working without modification.
InMemoryArtifactService,FileArtifactService,GcsArtifactService:concrete implementations.
_ForwardingArtifactServiceandPerAgentFileArtifactService: delegate tothe wrapped service.
This is a storage-layer change with no dependency on the live flow or the
cache manager, and it adds no new call sites; the caller that uses it ships
separately. It is not quite purely additive:
GcsArtifactService'sdelete_artifact()now has media frames to clean up, which it does from thelisting it already performs rather than by issuing an additional one.
Also documents the new method in the artifact service guide.
Testing:
tests/unittests/artifactsandtests/unittests/tools/test_forwarding_artifact_service.py: 999 passed.handling, timestamp ordering, and
NotImplementedErrorfrom the base class.