Repository navigation
Description
Is your feature request related to a problem?
Without --agent_engine_id, every adk deploy agent_engine run creates a brand-new Agent Runtime (cli_deploy.py: if not resource_name: runtime = client.runtimes.create()). This happens even when an engine with the same display_name already exists in the project and region, and nothing warns about it. The only place this is documented is the --agent_engine_id flag help. The deploy guide (docs/deploy/agent-runtime/deploy.md) does not mention updating or --agent_engine_id at all.
Teams that redeploy from a shell script or CI without knowing about the flag accumulate orphan engines. They also have to propagate a new resource ID into their app config on every release, because the app breaks if it still points at the previous engine.
In one engagement we found 88 engines deployed with only 15 in use on one project, 37 deployed / 16 in use on a second, and 88 on a third. Another 93 were left in a region the team no longer uses: a missing region setting fell back to us-central1, so region-scoped cleanup never saw them.
To reproduce (google-adk 2.9.0; same code on main @ 2.14.0):
adk deploy agent_engine --project P --region us-central1 --display_name my-agent ./my_agentprintsCreated a new instance: projects/P/locations/us-central1/reasoningEngines/111….- Run the same command again. It prints
Created a new instance: …/reasoningEngines/222…, with no warning. client.runtimes.list(config={"filter": 'display_name="my-agent"'})returns 2 engines.
Expected: a re-run with the same display name either warns that it is about to create a duplicate, or can be told to update the existing engine in place.
Actual: a silent duplicate. The app keeps calling the old engine until someone copies the new ID over.
Describe the solution you'd like
- Warning (default behaviour unchanged): before
runtimes.create(), list engines with the samedisplay_namein the project and region. If any exist, print a warning that lists their resource names andupdate_time, with a hint to use--agent_engine_idor--update_if_exists. Best-effort: never fail the deploy iflistfails. - Opt-in
--update_if_exists: with exactly 1 match, update it in place; with 0, create; with ≥2, fail with the ambiguous candidates listed. Mutually exclusive with--agent_engine_id. On a failed update of a pre-existing engine, do not delete it. Today the cleanup is keyed onagent_engine_id is None, which would delete it. - Docs: a "Redeploy / update an existing agent" section in the Agent Runtime deploy guide, plus a cleanup recipe.
- (Nice to have)
--output=jsonwithresource_nameandaction: created|updated, so scripts don't have to regex stdout.
This matches what agents-cli deploy already does (deploy/agent_runtime.py _resolve_target_agent: recorded ID first, else an unambiguous display-name match). Agent Starter Pack's deploy.py does the same. adk deploy agent_engine is the only Google deploy path that duplicates by default.
The lookup has to run after display_name is final, i.e. after the .agent_engine_config.json merge (related: #7619 / #7620).
Describe alternatives you've considered
- Always passing
--agent_engine_idfrom a pinned ID map, plus a prune script that diffs the project against that map. This is our current workaround. It works, but every team has to rediscover the need for it and rebuild it. - Making upsert the default. Rejected because some users intentionally keep several engines with the same name.
Additional context
- The server allows duplicate display names, and
CreateReasoningEngineRequesthas no user-specified ID, so idempotency has to come from the client (or from a separate API FR). - I'm happy to send the change. A sketch with tests is ready.
Activity
sanketpatil06 commentedon Nov 12, 2026
Hi @hlzuo, thank you for the feature request! Since you already have a solution in mind, please feel free to open a PR. Our team would be happy to review it.
hlzuo commentedon Nov 13, 2026
Thanks @sanketpatil06. We have a CL for this (
--update_if_exists, duplicatedisplay_namewarning, and thecreated_herecleanup guard) currently out for internal review with unit and live Agent Engine tests, which will mirror tomainvia Copybara withFixes #8061. Holding off on a duplicate GitHub PR so reviewers don't review it twice, though happy to mirror a tracking PR if your triage flow needs one.feat(cli): warn on duplicate Agent Engine display name and add --upda…