From 2489ed77d5e17f4b8ad9c98cf598a63ac2b2df71 Mon Sep 17 00:00:00 2001 From: Aarav Mittal <137450929+a2105z@users.noreply.github.com> Date: Sun, 16 Aug 2026 10:40:18 -0500 Subject: [PATCH] feat(cli): skip __init__.py for config-based adk create Config agents load from root_agent.yaml, matching existing samples that omit an empty package marker from generated scaffolding. --- src/google/adk/cli/cli_create.py | 6 +++--- tests/unittests/cli/utils/test_cli_create.py | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/google/adk/cli/cli_create.py b/src/google/adk/cli/cli_create.py index 13bd42cd099..73e378d2ec7 100644 --- a/src/google/adk/cli/cli_create.py +++ b/src/google/adk/cli/cli_create.py @@ -65,7 +65,6 @@ Agent created in {agent_folder}: - .env - .gitignore -- __init__.py - root_agent.yaml ⚠️ WARNING: Secrets (like GOOGLE_API_KEY) are stored in .env. @@ -139,8 +138,9 @@ def _generate_files( if type == "config": with open(agent_config_file_path, "w", encoding="utf-8") as f: f.write(_AGENT_CONFIG_TEMPLATE.format(model_name=model)) - with open(init_file_path, "w", encoding="utf-8") as f: - f.write("") + # Config agents are loaded from root_agent.yaml; they are not Python + # packages. Matching existing config samples, do not emit an empty + # __init__.py. click.secho( _SUCCESS_MSG_CONFIG.format(agent_folder=agent_folder), fg="green", diff --git a/tests/unittests/cli/utils/test_cli_create.py b/tests/unittests/cli/utils/test_cli_create.py index ed0a564310d..111dd93ab8b 100644 --- a/tests/unittests/cli/utils/test_cli_create.py +++ b/tests/unittests/cli/utils/test_cli_create.py @@ -287,10 +287,8 @@ def test_run_cmd_with_type_config( assert "model: gemini-2.5-flash" in yaml_content assert "description: A helpful assistant for user questions." in yaml_content - # Should create empty __init__.py - init_file = agent_dir / "__init__.py" - assert init_file.exists() - assert init_file.read_text().strip() == "" + # Config agents are YAML-loaded; do not emit a package marker. + assert not (agent_dir / "__init__.py").exists() # Should still create .env file env_file = agent_dir / ".env"