Skip to content

fix(cli): respect display_name from .agent_engine_config.json - #7620

Open
tosuri13 wants to merge 1 commit into
google:mainfrom
tosuri13:fix/agent-engine-display-name
Open

tosuri13 wants to merge 1 commit into
google:mainfrom
tosuri13:fix/agent-engine-display-name

Conversation

@tosuri13

@tosuri13 tosuri13 commented Oct 20, 2026 •

Copy link
Copy Markdown

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Problem:
adk deploy agent_engine ignores display_name from .agent_engine_config.json when --display_name is not passed. to_agent_engine sets the agent folder name as a fallback (display_name = display_name or app_name, added in d4b2a8b) before it reads the config file. As a result, display_name is always truthy and overwrites the value from the config file.

Solution:
Apply the folder-name fallback only when neither --display_name nor the config file sets display_name. This restores the behavior before d4b2a8b, so the precedence is --display_name > config file > folder name.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Added test_to_agent_engine_display_name_precedence to tests/unittests/cli/utils/test_cli_deploy.py. It covers three cases: the config file value is used, --display_name takes precedence, and the folder name is used when neither is set. The config-file case fails without the fix.

$ pytest tests/unittests/cli/utils/test_cli_deploy.py
168 passed

Manual End-to-End (E2E) Tests:

Deployed a minimal quickstart-style agent to a real Agent Platform project with this branch. The agent folder display_name_e2e contains this .agent_engine_config.json, and --display_name was not passed:

{
  "display_name": "Display Name From JSON",
  "description": "E2E check for google/adk-python#7620"
}
$ adk deploy agent_engine --project <project> --region us-central1 display_name_e2e
...
Reading agent platform config from .../display_name_e2e/.agent_engine_config.json
...
Deployed to Agent Platform: projects/<project>/locations/us-central1/reasoningEngines/<id>
  • The log no longer prints Overriding display_name in agent platform config with display_name_e2e.
  • The deployed resource has displayName: "Display Name From JSON" and description: "E2E check for google/adk-python#7620", as returned by the reasoningEngines.get API and shown in the Cloud Console below.

Cloud Console after deploying:
スクリーンショット 2026-10-20 11 14 02

Before the fix, the same setup produced the folder name as the display name. I checked this locally by running to_agent_engine with a fake agentplatform client and inspecting the config passed to runtimes.update():

  • Before: display_name = my_agent, description = Desc From JSON
  • After: display_name = Name From JSON, description = Desc From JSON

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 added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

to_agent_engine filled in the agent folder name as the display name before
reading .agent_engine_config.json, so the fallback always overwrote the
display_name from the config file. Fall back to the folder name only when
neither --display_name nor the config file sets one.

Fixes google#7619
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.

adk deploy agent_engine ignores display_name from .agent_engine_config.json

2 participants