Skip to content

Commit 655bbed

Browse files
authored
Fix frontend_type default and handling (#392)
- Change DEFAULT_FRONTEND from "streamlit" to "None" - Fix copy_frontend_files to properly handle "None" value - Prevent infinite recursion when default is "None" - Update documentation to reflect new default behavior This ensures agents with frontend_type: "None" (like adk_base) don't inadvertently get streamlit frontend files during templating.
1 parent 37910c4 commit 655bbed

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

agent_starter_pack/cli/utils/template.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def get_overwrite_folders(agent_directory: str) -> list[str]:
100100

101101
TEMPLATE_CONFIG_FILE = "templateconfig.yaml"
102102
DEPLOYMENT_FOLDERS = ["cloud_run", "agent_engine"]
103-
DEFAULT_FRONTEND = "streamlit"
103+
DEFAULT_FRONTEND = "None"
104104

105105

106106
def get_available_agents(deployment_target: str | None = None) -> dict:
@@ -1182,14 +1182,11 @@ def should_skip(path: pathlib.Path) -> bool:
11821182

11831183
def copy_frontend_files(frontend_type: str, project_template: pathlib.Path) -> None:
11841184
"""Copy files from the specified frontend folder directly to project root."""
1185-
# Skip copying if frontend_type is "None"
1186-
if frontend_type == "None":
1187-
logging.debug("Frontend type is 'None', skipping frontend files")
1185+
# Skip copying if frontend_type is "None" or empty
1186+
if not frontend_type or frontend_type == "None":
1187+
logging.debug("Frontend type is 'None' or empty, skipping frontend files")
11881188
return
11891189

1190-
# Use default frontend if none specified
1191-
frontend_type = frontend_type or DEFAULT_FRONTEND
1192-
11931190
# Get the frontends directory path
11941191
frontends_path = (
11951192
pathlib.Path(__file__).parent.parent.parent / "frontends" / frontend_type
@@ -1201,9 +1198,12 @@ def copy_frontend_files(frontend_type: str, project_template: pathlib.Path) -> N
12011198
copy_files(frontends_path, project_template, overwrite=True)
12021199
else:
12031200
logging.warning(f"Frontend type directory not found: {frontends_path}")
1204-
if frontend_type != DEFAULT_FRONTEND:
1201+
# Don't fall back to default if it's "None" - just skip
1202+
if DEFAULT_FRONTEND != "None":
12051203
logging.info(f"Falling back to default frontend: {DEFAULT_FRONTEND}")
12061204
copy_frontend_files(DEFAULT_FRONTEND, project_template)
1205+
else:
1206+
logging.debug("No default frontend configured, skipping frontend files")
12071207

12081208

12091209
def copy_deployment_files(

docs/guide/template-config-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This object contains fields that control the generated project's features and be
2727
| --------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
2828
| `deployment_targets` | list(string) | A list of deployment targets your template supports. Options: `agent_engine`, `cloud_run`. |
2929
| `tags` | list(string) | A list of tags for categorization. The `adk` tag enables special integrations with the Agent Development Kit. |
30-
| `frontend_type` | string | Specifies the frontend to use. Examples: `streamlit`, `adk_live_react`. Defaults to `streamlit`. |
30+
| `frontend_type` | string | Specifies the frontend to use. Examples: `streamlit`, `adk_live_react`. Defaults to `None` (no frontend). |
3131
| `agent_directory` | string | The name of the directory where agent code will be placed. Defaults to `app`. Can be overridden by the CLI `--agent-directory` parameter. |
3232
| `requires_data_ingestion` | boolean | If `true`, the user will be prompted to configure a datastore. |
3333
| `requires_session` | boolean | If `true`, the user will be prompted to choose a session storage type (e.g., `alloydb`) when using the `cloud_run` target. |

0 commit comments

Comments
 (0)