Skip to content

Add GCSArtifactService#110

Merged
baptmont merged 21 commits intogoogle:mainfrom
baptmont:gcs
Sep 25, 2025
Merged

Add GCSArtifactService#110
baptmont merged 21 commits intogoogle:mainfrom
baptmont:gcs

Conversation

@baptmont
Copy link
Copy Markdown
Contributor

Moved from #91
Changed to track forked gcs branch instead of main.


nextVersion := int64(1)

// TODO race condition, could use mutex but it's a remote resource so the issue would still occurs
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpasiukevich comment
Curious, how python/java handled this for their GCS implementation?

Do they have it as a known documented limitation or a TODO?

As an idea: version is an int64. What about if we fit a timestamp in there? e.g. https://pkg.go.dev/time#Time.UnixNano?

This gives us:

Monotonously increasing.
Nanosecond granularity -> minimum chance of collisions.
We'd have a capacity till 2262. After that our descendants I'm sure will solve it.
Author
@baptmont baptmont comment
The adk documentation doesn't address this issue/limitation.
The idea of using a timestamp works, but we would differ from the other adk implementations.
A system using both adk python and adk go agents would have conflicting behaviors.

}
// TODO agent can create files with multiple segments for example file a/b.txt
// This a/b.txt file will show as b.txt when listed and trying to load it will fail.
filename := segments[len(segments)-2] // appName/userId/sessionId/filename/version or appName/userId/user/filename/version
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpasiukevich comment
Overall question -- can we use GCS version features (asking out of curiosity) instead of handling versions ourselves?

https://pkg.go.dev/cloud.google.com/go/storage#Query
http://cloud/storage/docs/using-versioned-objects#storage-list-object-versions-go
@dpasiukevich comment
following up: One major issue it may solve -- fetching the last version of the artifact in one call if it's possible. O(N) -> O(1) for artifact creation request.

Is it possible to fetch latest artifact in one call?

Author
@baptmont comment
When using the GCS versioning the "noncurrent versions only appear in requests that explicitly call for them to be included" as such only the latest version would be retrieved, making it O(1).
This is something that should be explored for all versions of adk, since for now we want for a system using both adk python and adk go agents to have the same behavior.

@baptmont baptmont merged commit fe3a283 into google:main Sep 25, 2025
3 checks passed
@baptmont baptmont deleted the gcs branch October 6, 2025 09:21
davidli2010 pushed a commit to davidli2010/adk-go that referenced this pull request Feb 4, 2026
* Add GCSArtifactService.

* Fix dependecies diff

* Add io.Close err validation

* Standardize function and method naming for gcsService.

Rename functions and methods within the gcsService to improve clarity and align with Go conventions.

* Add artifactservice/gcs package, add request detailed validation

Moved the gcs artifact service implementation to a separate gcs package, and the test suite to artifactservice_test.

* Make mockable_gcs interfaces unexported

The mockable_gcs interface is only relevant for testing and its use can be limited to the gcs package.

* Add ValidatorTestCases interface to reduce duplicated code on test execution

* Move mockable_storage to test file

* Improve gcs service error handling, add support for parts with text. Add parallel execution on delete all versions.

* Add err validation to setAttrSelection

* Change test suite to include NewPartFromText example

* Add Client.Options to gcs artifact service constructor for configuring the client

* Add err context for request validation in artifact service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants