Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions agent_starter_pack/cli/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,9 @@ def create(
# Check if agent requires session management
requires_session = config.get("settings", {}).get("requires_session", False)

# Session type selection is only available for these agents on cloud_run
session_type_supported_agents = ("adk_base", "agentic_rag")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better maintainability and to follow common Python conventions for constants, consider defining this as a module-level constant (e.g., SESSION_TYPE_SUPPORTED_AGENTS) at the top of the file. This makes it easier to find and modify the list of supported agents in the future.


if requires_session:
if final_deployment == "agent_engine" and session_type:
console.print(
Expand All @@ -748,19 +751,27 @@ def create(
)
return

if (
final_deployment is not None
and final_deployment in ("cloud_run")
and not session_type
):
if auto_approve:
final_session_type = "in_memory"
console.print(
"Info: --session-type not specified. Defaulting to 'in_memory' in auto-approve mode.",
style="yellow",
)
if final_deployment == "cloud_run":
if deployment_agent_name in session_type_supported_agents:
# Allow session type selection for supported agents
if not session_type:
if auto_approve:
final_session_type = "in_memory"
console.print(
"Info: --session-type not specified. Defaulting to 'in_memory' in auto-approve mode.",
style="yellow",
)
else:
final_session_type = prompt_session_type_selection()
else:
final_session_type = prompt_session_type_selection()
# For unsupported agents, always use in_memory
final_session_type = "in_memory"
if session_type and session_type != "in_memory":
console.print(
f"Warning: Session type selection is only available for {', '.join(session_type_supported_agents)} agents. "
"Using in-memory sessions for this agent.",
style="yellow",
)
else:
# Agents that don't require session management always use in-memory sessions
final_session_type = "in_memory"
Expand Down