Fix(cli): validate agent folder name for dashes in agent_engine deploy - #6760
Open
Ahmed-Ali-313 wants to merge 2 commits into
Open
Fix(cli): validate agent folder name for dashes in agent_engine deploy#6760Ahmed-Ali-313 wants to merge 2 commits into
Ahmed-Ali-313 wants to merge 2 commits into
Conversation
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 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #2902
When deploying an agent using
adk deploy agent_enginewhere 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
_validate_agent_folder_nameincli_deploy.pyto validate that the agent directory name is a valid Python identifier before deployment begins.my_agent_folder).test_cli_deploy.pyverifying validation behavior for valid and invalid names.Test Plan
pytest tests/unittests/cli/utils/test_cli_deploy.py(54 passed).