Harness

Budget guard

Cap tool calls per run, executions per hour for the same agent and person, and model spend per run.

budget denies calls once a limit is used up. Limits are counted by the harness, in the run's store. This is separate from the budget set on the agent in Scute, which the engine enforces and which pauses the agent when exceeded (see Agents).

guards.budget({ calls: 20, perHour: { high: 5 }, usdPerRun: 2 });

Options#

callsnumber
Tool calls per run.
perHour / per_hournumber or map
Executions in the last hour for this agent and person, across all their runs. A number caps all calls; a map caps per tier (low, medium, high), and tiers not in the map are not capped.
usdPerRun / usd_per_runnumber
Model spend per run, from what you report with run.recordUsage().
modeenforce, monitor or observe
Overrides the harness mode.

No option is required; an omitted limit is not enforced.

What is counted#

  • Calls. A call counts when its verdict lets it run (proceed or transform), at check time. Calls that are refused, guided or waiting for a person do not count. With the AI SDK, a call waiting on the person's tool approval is counted once, when it runs after they approve.
  • Hourly executions. The same moment, recorded with the call's tier under scute:hour:<agent>:<person>. For runs on a task token without actsFor, the person comes from the task (whoami).
  • Spend. Whatever you add:
await run.recordUsage({ usd: 0.012 });

Because checks in a run go one at a time and a call takes its share when it is allowed, parallel tool calls in one step cannot overspend.

Decisions#

LimitReasonMessage
callsbudget_exhaustedThis run has used its 20 tool calls. Stop here and tell the person what's left.
usdPerRunbudget_exhaustedThis run has spent its $2 budget. Stop here and tell the person what's left.
perHour (number)budget_exhaustedThe hourly limit of 5 actions is reached. Tell the person to try again later.
perHour (per tier)budget_exhaustedThe hourly limit of 5 high-risk actions is reached. Tell the person to try again later.

All are deny.

Stop the loop#

Ask whether a run budget (calls or spend) is used up, to end the agent loop instead of letting the model keep trying:

TypeScriptPythonRuby
await run.budgetExhausted()run.budget_exhausted()run.budget_exhausted?

With the Vercel AI SDK, pass run.budgetExceeded to stopWhen. Hourly limits are not part of this check.