Skip to content

feat(agentengine): support deploying from container image URI#775

Open
jankrynauw wants to merge 3 commits into
google:mainfrom
alis-exchange:feat/deploy-from-docker-image
Open

feat(agentengine): support deploying from container image URI#775
jankrynauw wants to merge 3 commits into
google:mainfrom
alis-exchange:feat/deploy-from-docker-image

Conversation

@jankrynauw
Copy link
Copy Markdown

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/aiplatform v1.124.0, Reasoning Engine creation/update supports ReasoningEngineSpec_ContainerSpec_ with ImageUri, but the CLI has no way to pass a prebuilt container image URI.

Solution:
Added an --image_url flag to adkgo deploy agentengine.

When provided, the deploy flow uses ReasoningEngineSpec_ContainerSpec_ and sets ContainerSpec.ImageUri to the supplied Artifact Registry image URI, for example:
us-central1-docker.pkg.dev/my-project/my-repo/my-image:tag

The 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:

  • I have manually tested my changes end-to-end.

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:

  • The command uses ReasoningEngineSpec_ContainerSpec_.
  • ContainerSpec.ImageUri is set to the supplied URI.
  • No Dockerfile is prepared.
  • No source archive is created.
  • Local-source-only flags are rejected when provided with --image_url.

Checklist

  • I have read the ./CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have manually tested my changes end-to-end.

Additional context

This relies on cloud.google.com/go/aiplatform v1.124.0, which includes support for ReasoningEngineSpec_ContainerSpec_ and ContainerSpec.ImageUri.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread cmd/adkgo/internal/deploy/agentengine/agentengine.go
@kdroste-google kdroste-google self-requested a review April 30, 2026 11:14
@kdroste-google
Copy link
Copy Markdown
Collaborator

gemini /review

Copy link
Copy Markdown
Collaborator

@kdroste-google kdroste-google left a comment

Choose a reason for hiding this comment

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

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))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is not valid anymore. The container can provide pretty much anything.

I see two options here:

  1. separate the functionality of deploying from the source code and deploying any container
  2. instead of the container deploy binary file (like for Cloud Run)
    What do you think?

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.

Add Agent Engine deploy support for prebuilt container image URI

2 participants