Skip to content

feat: support file_data URI references in GcsArtifactService#5322

Open
blueeye-040 wants to merge 1 commit intogoogle:mainfrom
blueeye-040:feat/gcs-file-data-support
Open

feat: support file_data URI references in GcsArtifactService#5322
blueeye-040 wants to merge 1 commit intogoogle:mainfrom
blueeye-040:feat/gcs-file-data-support

Conversation

@blueeye-040
Copy link
Copy Markdown

@blueeye-040 blueeye-040 commented Apr 14, 2026

GcsArtifactService previously raised NotImplementedError when saving a types.Part with file_data. This PR adds full file_data URI support to match the existing InMemoryArtifactService behavior.

Link to Issue or Description of Change

Problem:
GcsArtifactService._save_artifact raised NotImplementedError for file_data parts, while InMemoryArtifactService already handled them. This made GcsArtifactService unusable for any workflow that passes file URI references (e.g. gs:// or artifact:// URIs) as artifacts.

Solution:
Store file_data URI references as zero-byte GCS blobs with a file_uri custom metadata key — no content to upload, just the URI pointer. On load, check for that metadata key before downloading bytes and restore the original types.Part(file_data=...). Also switched _load_artifact to use bucket.get_blob() (which populates metadata) instead of bucket.blob() (which does not). artifact:// URIs are validated via artifact_util.parse_artifact_uri before saving.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Added 4 new tests in tests/unittests/artifacts/test_artifact_service.py:

  • test_gcs_save_artifact_with_external_gcs_uri — roundtrip save/load with a gs:// URI
  • test_gcs_save_artifact_with_artifact_ref_uri — roundtrip save/load with an artifact:// URI
  • test_gcs_save_artifact_file_data_without_mime_typefile_data with no mime_type
  • test_gcs_save_artifact_file_data_missing_uri_raises — empty file_uri raises InputValidationError

@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 14, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@blueeye-040 blueeye-040 changed the title feat: support file_data URI references in GcsArtifactService #5230 feat: support file_data URI references in GcsArtifactService Apr 14, 2026
@adk-bot adk-bot added the services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc label Apr 14, 2026
@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented Apr 14, 2026

Response from ADK Triaging Agent

Hello @blueeye-040, thank you for your contribution!

Before we can review your pull request, you'll need to sign the Contributor License Agreement (CLA). You can do this at https://cla.developers.google.com/.

Once you've signed the CLA, the status of the check will be updated. Thanks!

@blueeye-040
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@blueeye-040 blueeye-040 force-pushed the feat/gcs-file-data-support branch from 68d876d to fb49ae6 Compare April 14, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Support file_data (URI references) in GcsArtifactService.save_artifact

2 participants