feat(agentengine): support deploying from container image URI#775
feat(agentengine): support deploying from container image URI#775jankrynauw wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for deploying to Agent Engine using a prebuilt container image via a new --image_url flag, complementing the existing local source deployment method. The changes include refactoring the deployment and update logic to handle both container and source-based specifications, as well as updating several project dependencies. Feedback highlights a critical bug in the validation logic within computeFlags, where path initialization and temporary directory creation occur before the image_url check, causing the command to erroneously fail when a container image is specified.
|
gemini /review |
kdroste-google
left a comment
There was a problem hiding this comment.
Thank you for this contribution!
I think it makes sense to provide the functionality of deploying a container. I would say it is a very distinct one from deploying from the source code.
Splitting those two would make sense.
adkgo deploy container --project_name AAA --region BBB --name CCC --image_url DDD
Unfortunately it leaves unresolved the issue about class_methods, secrets, env etc.
Or instead (like for the CloudRun) we could deploy a binary.
However in the past I have encountered some problems with 8MB limits. I have not tested it against the most recent version. I don't know if this limit applies to the container as well.
| @@ -239,37 +293,30 @@ func (f *deployAgentEngineFlags) gcloudDeployToAgentEngine() error { | |||
| } | |||
| p("Methods:", string(methodsJSON)) | |||
There was a problem hiding this comment.
This is not valid anymore. The container can provide pretty much anything.
I see two options here:
- separate the functionality of deploying from the source code and deploying any container
- instead of the container deploy binary file (like for Cloud Run)
What do you think?
Closes: #774
Adds support for deploying an Agent Engine from a prebuilt Artifact Registry Docker image instead of always packaging local source.
Problem:
Agent Engine deployment currently assumes the local source archive path. With
cloud.google.com/go/aiplatformv1.124.0, Reasoning Engine creation/update supportsReasoningEngineSpec_ContainerSpec_withImageUri, but the CLI has no way to pass a prebuilt container image URI.Solution:
Added an
--image_urlflag toadkgo deploy agentengine.When provided, the deploy flow uses
ReasoningEngineSpec_ContainerSpec_and setsContainerSpec.ImageUrito the supplied Artifact Registry image URI, for example:us-central1-docker.pkg.dev/my-project/my-repo/my-image:tagThe image-based path skips Dockerfile generation, source archive creation, and source archive reading. It also rejects local-source-only options when --image_url is set: --entry_point_path, --source_dir, --temp_dir, and explicitly provided --server_port.
The existing local source deployment path is preserved when --image_url is not provided.
Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
I was able to successfully deploy and agent to Agent Platform from a container stored on Google Artifact Registry.
Manual deploy validation should be done with an Artifact Registry image URI, for example:
adkgo deploy agentengine
--project_name my-project
--region us-central1
--image_url us-central1-docker.pkg.dev/my-project/my-repo/my-image:tag
Expected behavior:
Checklist
Additional context
This relies on cloud.google.com/go/aiplatform v1.124.0, which includes support for ReasoningEngineSpec_ContainerSpec_ and ContainerSpec.ImageUri.