From 004e15ccb7c7f683623f8e7d2e77a9d12558c545 Mon Sep 17 00:00:00 2001 From: Yeesian Ng Date: Tue, 3 Feb 2026 13:11:14 -0800 Subject: [PATCH] feat: Allow passthrough of GOOGLE_CLOUD_LOCATION for AgentEngine deployments Co-authored-by: Yeesian Ng PiperOrigin-RevId: 865013321 --- src/google/adk/cli/cli_deploy.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/google/adk/cli/cli_deploy.py b/src/google/adk/cli/cli_deploy.py index dcec5186..465ca6c3 100644 --- a/src/google/adk/cli/cli_deploy.py +++ b/src/google/adk/cli/cli_deploy.py @@ -867,8 +867,12 @@ def to_agent_engine( absolutize_imports (bool): Optional. Default is True. Whether to absolutize imports. If True, all relative imports will be converted to absolute import statements. - project (str): Optional. Google Cloud project id. - region (str): Optional. Google Cloud region. + project (str): Optional. Google Cloud project id for the deployed agent. If + not specified, the project from the `GOOGLE_CLOUD_PROJECT` environment + variable will be used. It will be ignored if `api_key` is specified. + region (str): Optional. Google Cloud region for the deployed agent. If not + specified, the region from the `GOOGLE_CLOUD_LOCATION` environment + variable will be used. It will be ignored if `api_key` is specified. display_name (str): Optional. The display name of the Agent Engine. description (str): Optional. The description of the Agent Engine. requirements_file (str): Optional. The filepath to the `requirements.txt` @@ -882,10 +886,9 @@ def to_agent_engine( to use. If not specified, the `.agent_engine_config.json` file in the `agent_folder` will be used. skip_agent_import_validation (bool): Optional. Default is True. If True, - skip the - pre-deployment import validation of `agent.py`. This can be useful when - the local environment does not have the same dependencies as the - deployment environment. + skip the pre-deployment import validation of `agent.py`. This can be + useful when the local environment does not have the same dependencies as + the deployment environment. """ app_name = os.path.basename(agent_folder) display_name = display_name or app_name @@ -1014,7 +1017,7 @@ def to_agent_engine( project = env_project click.echo(f'{project=} set by GOOGLE_CLOUD_PROJECT in {env_file}') if 'GOOGLE_CLOUD_LOCATION' in env_vars: - env_region = env_vars.pop('GOOGLE_CLOUD_LOCATION') + env_region = env_vars.get('GOOGLE_CLOUD_LOCATION') if env_region: if region: click.secho(