use global turn limit as subagent turn limit fallback (#12992)
This commit is contained in:
@@ -272,7 +272,7 @@ Subagents use the following pre-configured settings, but you can override any de
|
||||
| Parameter | Default | How to Customize |
|
||||
|-----------|---------|------------------|
|
||||
| **Maximum Concurrent Subagents** | 5 | Set `GOOSE_MAX_CONCURRENT_SUBAGENTS` to a positive integer. Additional tasks wait until a running subagent finishes. The limit applies per parent session. |
|
||||
| **Max Turns** | 25 | Use natural language, set `GOOSE_SUBAGENT_MAX_TURNS`, or configure `settings.max_turns` in [recipes](/docs/guides/recipes/recipe-reference#settings) or subagent tool calls |
|
||||
| **Max Turns** | `GOOSE_MAX_TURNS`, otherwise 1000 | Use natural language, set `GOOSE_SUBAGENT_MAX_TURNS`, or configure `settings.max_turns` in [recipes](/docs/guides/recipes/recipe-reference#settings) or subagent tool calls |
|
||||
| **Timeout** | 5 minutes | Request longer timeout in your prompt |
|
||||
| **Extensions** | Inherited from parent | Specify which extensions to use in your prompt |
|
||||
| **Return Mode** | All subagent information provided in main session | Specify how much detail you want in your prompt |
|
||||
@@ -294,7 +294,15 @@ You can override any default by including the setting in your natural language r
|
||||
"Use a research subagent with 30 turns and 20-minute timeout to investigate quantum computing trends"
|
||||
```
|
||||
|
||||
**Environment variable:** Set `GOOSE_SUBAGENT_MAX_TURNS` to change the default max turns for all subagents. Similarly, `GOOSE_SUBAGENT_MODEL` and `GOOSE_SUBAGENT_PROVIDER` set defaults for the subagent model and provider; recipe [`settings`](/docs/guides/recipes/recipe-reference#settings) take precedence over both.
|
||||
Subagent turn limits use the first configured value below:
|
||||
|
||||
1. The `delegate` tool's `max_turns` argument.
|
||||
2. The child recipe's `settings.max_turns`.
|
||||
3. `GOOSE_SUBAGENT_MAX_TURNS` in the environment or configuration file.
|
||||
4. `GOOSE_MAX_TURNS` in the environment or configuration file.
|
||||
5. The default of 1000.
|
||||
|
||||
`GOOSE_SUBAGENT_MODEL` and `GOOSE_SUBAGENT_PROVIDER` set defaults for the subagent model and provider; recipe [`settings`](/docs/guides/recipes/recipe-reference#settings) take precedence over both.
|
||||
|
||||
### Extension Control
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ These variables control how goose manages conversation sessions and context.
|
||||
| `GOOSE_MAX_TURNS` | [Maximum number of turns](/docs/guides/sessions/smart-context-management#maximum-turns) allowed without user input | Integer (e.g., 10, 50, 100) | 1000 |
|
||||
| `GOOSE_GATEWAY_MAX_TURNS` | Maximum number of turns for gateway sessions (e.g., Telegram). Overrides `GOOSE_MAX_TURNS` for gateway traffic only, so chat platforms can keep a stricter cap than CLI/desktop sessions. | Integer (e.g., 5, 10, 25) | Falls back to `GOOSE_MAX_TURNS`, then 5 |
|
||||
| `GOOSE_MAX_CONCURRENT_SUBAGENTS` | Maximum number of subagents running at once per parent session. Additional tasks wait for a slot. Unset or invalid values use the default. | Positive integer (e.g., 2, 5, 10) | 5 |
|
||||
| `GOOSE_SUBAGENT_MAX_TURNS` | Sets the maximum turns allowed for a [subagent](/docs/guides/context-engineering/subagents) to complete before timeout. Can be overridden by [`settings.max_turns`](/docs/guides/recipes/recipe-reference#settings) in recipes or subagent tool calls. | Integer (e.g., 25) | 25 |
|
||||
| `GOOSE_SUBAGENT_MAX_TURNS` | Overrides the turn budget for [subagents](/docs/guides/context-engineering/subagents). An explicit delegate `max_turns` or child recipe [`settings.max_turns`](/docs/guides/recipes/recipe-reference#settings) takes precedence. | Positive integer (e.g., 25) | Falls back to `GOOSE_MAX_TURNS`, then 1000 |
|
||||
| `CONTEXT_FILE_NAMES` | Specifies custom filenames for [hint/context files](/docs/guides/context-engineering/using-goosehints#custom-context-files) | JSON array of strings (e.g., `["CLAUDE.md", ".goosehints"]`) | `[".goosehints", "AGENTS.md"]` |
|
||||
| `GOOSE_DISABLE_SESSION_NAMING` | Disables automatic AI-generated session naming; avoids the background model call and keeps the default "CLI Session" (goose CLI) or "New Chat" (goose Desktop) | "1", "true" (case-insensitive) to enable | false |
|
||||
| `GOOSE_PROMPT_EDITOR` | [External editor](/docs/guides/goose-cli-commands#external-editor-mode) to use for composing prompts instead of CLI input | Editor command (e.g., "vim", "code --wait") | Unset (uses CLI input) |
|
||||
|
||||
@@ -504,13 +504,15 @@ The `settings` field allows you to configure the AI model and provider settings
|
||||
|
||||
#### Understanding max_turns
|
||||
|
||||
The `max_turns` setting controls how many iterations an agent can perform before stopping. When set in a recipe's settings, it applies to that recipe's execution and any subagents or subrecipes it creates (unless they specify their own value).
|
||||
The `max_turns` setting controls how many iterations an agent can perform before stopping. When set in a recipe's settings, it applies to that recipe's execution.
|
||||
|
||||
**Configuration precedence (highest to lowest):**
|
||||
1. Subagent tool call override
|
||||
2. Recipe `settings.max_turns`
|
||||
3. `GOOSE_SUBAGENT_MAX_TURNS` environment variable
|
||||
4. Default value (1000 for main recipes, 25 for subagents)
|
||||
**Subagent configuration precedence (highest to lowest):**
|
||||
|
||||
1. The `delegate` tool's `max_turns` argument.
|
||||
2. The child recipe's `settings.max_turns`.
|
||||
3. `GOOSE_SUBAGENT_MAX_TURNS` in the environment or configuration file.
|
||||
4. `GOOSE_MAX_TURNS` in the environment or configuration file.
|
||||
5. The default of 1000.
|
||||
|
||||
**Common use cases:** Limit execution time for automated workflows, prevent runaway subagents, control resource usage in scheduled jobs.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user