> ## Documentation Index
> Fetch the complete documentation index at: https://stampede.autonomousorganizations.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Budgets and timeouts

> The model-call and input-token budgets of a turn, what budget_exhausted means, and the time limits of turns and commands.

Every turn runs under fixed ceilings so a model in a long tool loop cannot run up cost or time without bound. A turn is one request to the model and everything it does to answer: its model calls, tool calls and sub-agents. Two budgets are configurable in the `[tools]` section of `~/.stampede/config.toml`. Time limits are set per profile and per command.

## Turn budgets

```toml theme={null}
[tools]
turn_model_calls = 26        # model calls one turn may make
turn_input_tokens = 500000   # input tokens one turn may send
```

| Key | Range | Default | Meaning |
| - | - | - | - |
| `turn_model_calls` | 2 to 100 | 26 | Total model calls in one turn. Two are kept as a closing reserve, so a turn makes at most this value minus two ordinary calls (24 by default) before it must conclude. A value of 2 allows the conclusion only. |
| `turn_input_tokens` | 100,000 to 5,000,000 | 500,000 | Input tokens one turn may send across all its model calls. |

A value outside the range is refused when the file loads, with the key named.

Every model call re-sends the conversation so far, so input grows with each round of a tool loop, and the count includes cache reads in full. On a large-window model `turn_input_tokens` can end a turn before `turn_model_calls` does, so raising `turn_model_calls` alone may not lengthen the turn. A repository task such as editing a site, building it and opening a pull request needs about:

```toml theme={null}
[tools]
turn_model_calls = 60
turn_input_tokens = 2000000
```

Two more per-turn limits are fixed: 100 tool calls and 100,000 output tokens.

The budgets cover the whole turn: the parent and all of its [sub-agents](https://stampede.autonomousorganizations.ai/teamwork/sub-agents.md) draw from them. They apply to turns this machine starts: console and TUI turns, `stampede agent`, goal episodes, and a person's runs for mail, gateway requests and schedules. A [task room](https://stampede.autonomousorganizations.ai/teamwork/mail-and-task-rooms.md) has no budget of its own; each wake is one run under these limits.

A request from a [paired machine](https://stampede.autonomousorganizations.ai/teamwork/multiple-machines.md) gets at most the smaller of your value and the default (26 calls, 500,000 tokens). Raising the keys never widens a peer's run, and lowering them binds it too. A resumed run keeps the limits recorded when it started.

## budget\_exhausted

A finished run carries a stop word, shown by `stampede runs show RUN_ID` as a `stop:` line and by `stampede agent` as `[stopped: WORD]` on stderr. `budget_exhausted` means the run reached a budget other than time: the model calls, the input tokens, the tool calls or the output tokens. `wall_clock` means it reached its time limit.

At either limit the run makes one closing call with no tools and asks the model for a handoff summary in three parts:

```text theme={null}
Done: what is finished.
Not done: what remains.
Next: the next step for whoever continues.
```

That summary is the run's answer. If the closing call fails, the run says so in a fixed line instead. When runs stop with `budget_exhausted` on work you expect to finish, raise the budget that was reached.

## Turn time limit

Each profile has a wall-clock limit for one turn, set with `timeout_secs` on the profile:

```toml theme={null}
[models.sonnet]
provider = "anthropic"
model = "claude-sonnet-5"
key_env = "ANTHROPIC_API_KEY"
timeout_secs = 900
```

The default is 300 seconds, and 1800 seconds for a session provider. One extra minute is kept for the closing summary. Sub-agents share their parent's deadline.

## Command timeout

A command started with `run_command` stops after 60 seconds unless the call asks for longer with its `timeout_secs` argument, up to 1800 seconds. The limit is never past the time the run has left, so a command can run only as long as the turn time limit allows.

| | Value |
| - | - |
| Default | 60 seconds |
| Maximum | 1800 seconds, and never past the run's remaining time |
| How to set it | the `timeout_secs` argument of each `run_command` call |

There is no configuration key for it. The model passes `timeout_secs` when it expects a long command, and you can ask for it in the task:

```text theme={null}
Run npm run build in the site directory with timeout_secs 600, then report any errors.
```

For a build that takes ten minutes, raise the profile's `timeout_secs` as well (for example to 900), or the turn ends first.

A command stopped at its limit has its process group stopped. The run gets a timed-out result with what the command printed and goes on; the command may have changed files before it stopped. `start_command` runs a command in the background with no default limit. Sub-agents of a person run commands in the foreground only, under the same limit.

## Applying changes

The configuration is read when a process starts. After editing `config.toml`:

```bash theme={null}
stampede doctor
stampede service restart
```

`stampede doctor` prints the loaded values in its config row (`turn_model_calls = N; turn_input_tokens = N`). `stampede service restart` restarts the installed workers (`node`, `schedule`, `gateway`, `webhook`), which serve person runs. Name one to restart only that worker, as in `stampede service restart gateway`. Open consoles keep the values they started with; start a new one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.