Agent Engine supports --extra_packages, but Cloud Run and GKE deployments do not. Agents that share local Python packages therefore need duplicated code or custom deployment steps.
Solution
Add a repeatable --extra_packages option to adk deploy cloud_run and adk deploy gke.
Share package-staging logic across Agent Engine, Cloud Run, and GKE.
Stage each file or directory at the build root, copy it to /app/<basename>, and keep /app on PYTHONPATH.
Preserve missing-path and destination-conflict validation.
Leave generated deployment output unchanged when the option is not used.
The tests cover CLI forwarding, file and directory staging, generated Dockerfile instructions, existing Agent Engine behaviour, and Click option consistency.
All applicable pre-commit hooks passed.
Manual E2E
Not run against Cloud Run or GKE because that requires cloud credentials and billable resources. Unit tests build and inspect the exact deployment context and Dockerfile.
Checklist
I have read the CONTRIBUTING document.
I have self-reviewed this change.
I have added regression tests.
Relevant tests pass locally.
I have deployed the generated image to Cloud Run or GKE.
This change has no downstream dependencies.
Additional context
The option semantics match the existing Agent Engine flag so projects can use one package layout across all supported deployment targets.
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
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.
Link to Issue or Description of Change
Problem
Agent Engine supports --extra_packages, but Cloud Run and GKE deployments do not. Agents that share local Python packages therefore need duplicated code or custom deployment steps.
Solution
Testing Plan
pytest tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py tests/unittests/cli/utils/test_cli_deploy.py tests/unittests/cli/utils/test_cli_tools_click.py tests/unittests/cli/test_cli_tools_click_option_mismatch.py -q
190 passed, 1 xfailed in 5.94s
The tests cover CLI forwarding, file and directory staging, generated Dockerfile instructions, existing Agent Engine behaviour, and Click option consistency.
All applicable pre-commit hooks passed.
Manual E2E
Not run against Cloud Run or GKE because that requires cloud credentials and billable resources. Unit tests build and inspect the exact deployment context and Dockerfile.
Checklist
Additional context
The option semantics match the existing Agent Engine flag so projects can use one package layout across all supported deployment targets.