diff --git a/src/google/adk/cli/cli_deploy.py b/src/google/adk/cli/cli_deploy.py index 2787c8d9..d6394ff2 100644 --- a/src/google/adk/cli/cli_deploy.py +++ b/src/google/adk/cli/cli_deploy.py @@ -105,7 +105,8 @@ from vertexai.agent_engines import AdkApp if {is_config_agent}: from google.adk.agents import config_agent_utils - root_agent = config_agent_utils.from_config("{agent_folder}/root_agent.yaml") + config_path = os.path.join(os.path.dirname(__file__), "root_agent.yaml") + root_agent = config_agent_utils.from_config(config_path) else: from .agent import {adk_app_object} diff --git a/tests/unittests/cli/utils/test_cli_deploy.py b/tests/unittests/cli/utils/test_cli_deploy.py index 43b9e07a..36484da1 100644 --- a/tests/unittests/cli/utils/test_cli_deploy.py +++ b/tests/unittests/cli/utils/test_cli_deploy.py @@ -226,6 +226,19 @@ def test_get_service_option_by_adk_version( assert actual.rstrip() == expected.rstrip() +def test_agent_engine_app_template_compiles_with_windows_paths() -> None: + """It should not emit invalid Python when paths contain `\\u` segments.""" + rendered = cli_deploy._AGENT_ENGINE_APP_TEMPLATE.format( + is_config_agent=True, + agent_folder=r".\user_agent_tmp20260101_000000", + adk_app_object="root_agent", + adk_app_type="agent", + trace_to_cloud_option=False, + express_mode=False, + ) + compile(rendered, "", "exec") + + @pytest.mark.parametrize("include_requirements", [True, False]) def test_to_agent_engine_happy_path( monkeypatch: pytest.MonkeyPatch,