Skip to content

Fix(cli): validate agent folder name for dashes in agent_engine deploy - #6760

Open
Ahmed-Ali-313 wants to merge 2 commits into
google:mainfrom
Ahmed-Ali-313:fix-agent-engine-dash-validation
Open

Fix(cli): validate agent folder name for dashes in agent_engine deploy#6760
Ahmed-Ali-313 wants to merge 2 commits into
google:mainfrom
Ahmed-Ali-313:fix-agent-engine-dash-validation

Conversation

@Ahmed-Ali-313

Copy link
Copy Markdown
Contributor

Description

Fixes #2902

When deploying an agent using adk deploy agent_engine where the agent folder name contains dashes (e.g., my-agent-folder), Vertex AI Agent Engine fails at deployment runtime with a Python syntax error (invalid syntax (agent_engine_app.py)) because module names in Python cannot contain dashes.

Changes

  • Added _validate_agent_folder_name in cli_deploy.py to validate that the agent directory name is a valid Python identifier before deployment begins.
  • Provided a clear and actionable error message suggesting an underscore-based alternative (e.g., my_agent_folder).
  • Added unit tests in test_cli_deploy.py verifying validation behavior for valid and invalid names.

Test Plan

  • Ran pytest suite: pytest tests/unittests/cli/utils/test_cli_deploy.py (54 passed).

@Ahmed-Ali-313

Copy link
Copy Markdown
Contributor Author

Hi @wyf7107,

I have submitted this PR to resolve #2902 by adding pre-deployment validation for agent folder names in cli_deploy.py.

It validates that the agent directory name is a valid Python identifier, preventing runtime syntax errors on Agent Engine caused by dashes, and provides a clear, actionable error message suggesting an underscore-based alternative.

All unit tests have been added and verified. Whenever you have a moment, please review the changes. Thank you

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" fails if the agent folder name contains dashes.

2 participants