-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: Add max_turns to recipe and subagent settings #6198
Description
Please explain the motivation behind the feature request.
Subagents have a default max_turns limit of 25. Complex tasks (e.g., multi-file implementations with build/test verification) can exceed this limit, causing the subagent to stop with "I've reached the maximum number of actions I can do without user input."
Currently, the only way to configure this is via the GOOSE_SUBAGENT_MAX_TURNS environment variable, which:
- Requires external setup before running goose
- Applies globally to all subagents
- Cannot be shared as part of a recipe
Describe the solution you'd like
Add max_turns field to:
Settingsstruct incrates/goose/src/recipe/mod.rs- for top-level recipe configurationSubagentSettingsstruct incrates/goose/src/agents/subagent_tool.rs- for per-subagent configuration
This would allow recipes to specify:
settings:
goose_provider: "gcp_vertex_ai"
goose_model: "claude-sonnet-4-5@20250929"
max_turns: 50And subagent tool calls to override:
{
"settings": {
"model": "claude-haiku-4-5@20251001",
"max_turns": 30
}
}Describe alternatives you've considered
Setting GOOSE_SUBAGENT_MAX_TURNS=50 in shell config. This works but is not portable across machines or shareable in recipes.
Additional context
Related: #3938 requested max turns for subagents but was closed before implementation. Since then, SubagentSettings was added with provider, model, temperature - adding max_turns would complete this.
Relevant code:
-
crates/goose/src/agents/subagent_task_config.rs- definesDEFAULT_SUBAGENT_MAX_TURNS(25) and reads env var -
crates/goose/src/agents/subagent_tool.rs-apply_settings_overrideswould need to handlemax_turns -
I have verified this does not duplicate an existing feature request