A budget is a spending cap that cannot be passed. Before every model call the worst-case cost is reserved; if a
budget cannot take it, the call is not made and the task waits for a person. You set budgets in
nuramesh.yaml.
Diagram as text
- Before a model call, the worst-case cost is reserved against every budget that applies.
- The call is made only if every budget can take the reservation. If one cannot, the call is not made and the task waits for a person.
- After the call the real cost is settled and the rest of the reservation is released.
Prerequisites
Section titled “Prerequisites”- A team folder that passes
nuramesh validate(Start from a template). The examples use adev-teamfolder namedmy-team. - A price for every model the team uses. A call with an unknown price is blocked, never guessed: Override a price.
-
Open
my-team/nuramesh.yamland find thebudgetslist. Each budget has an id, a scope, the id of what it caps and a limit.budgets:- {id: dana-monthly, scope: agent, scope_id: dana, limit: {amount: "5.00", currency: USD}}- {id: rhea-monthly, scope: agent, scope_id: rhea, limit: {amount: "5.00", currency: USD}}Key Value scoperun,task,agent,teamororgscope_idthe id of the run, task or agent; for teamthe id of its lead; fororgthe organization’s idlimitan amount and a currency. Write the amount in quotes, as text. USDis the only currency todaywindowoptional: dayormonth(UTC calendar). Without it the limit is for the budget’s whole lifeon_breachoptional, for a budget with a window: resetorholdat the next window after a breach -
Add a cap for the whole organization per day: one new line at the end of the list.
budgets:- {id: dana-monthly, scope: agent, scope_id: dana, limit: {amount: "5.00", currency: USD}}- {id: rhea-monthly, scope: agent, scope_id: rhea, limit: {amount: "5.00", currency: USD}}- {id: org-daily, scope: org, scope_id: my-team, window: day, limit: {amount: "20.00", currency: USD}}scope_idof theorgbudget is theorg.idat the top of the file. Every budget that applies to a call must be able to pay for it: here the developer’s calls count againstdana-monthlyandorg-daily. -
Check the file and run the team.
Terminal window nuramesh validate my-team/nuramesh.yamlnuramesh try my-team --fake --approve-as human:you --allow-unsandboxed --run-id budget-1The fake model costs nothing real, but its calls are priced from the
pricessection, so budgets behave as they would with a real model.
Check it worked
Section titled “Check it worked”The report has one line per budget, with what was spent and what is reserved:
Budgets: dana-monthly (agent dana): spent 0.002670 of 5.00, reserved 0.000000 org-daily (org my-team): spent 0.003471 of 20.00 per day (the current window, since 2026-11-18T00:00:00.000000Z, as of the report), reserved 0.000000Your amounts and dates will differ. The rb- line is the run budget that the template’s team.py adds for
each run.
To see the hard stop itself, add a second, very small budget for the developer and run again with a new run id:
- {id: dana-tight, scope: agent, scope_id: dana, limit: {amount: "0.001", currency: USD}}nuramesh try my-team --fake --approve-as human:you --allow-unsandboxed --run-id budget-2BREACH ALERT: hard stop on budget dana-tight (agent dana), limit 0.001; no reset: the lifetime limit is used up (a human can raise it)Run budget-2Tasks: 2 cancelled, 1 needs_human [needs_human] budget-2-fix-add (dana, attempts 1): Fix the failing add() test in calc.py note: budget hard stop (dana-tight)The call was never made: the dana-tight line shows spent 0. The tasks that depended on it are cancelled,
and the command exits with code 1. This is a demonstration in a throwaway folder: a budget that a run has
used stays in the team’s records and still appears in the report after you take its line out of the file.
Change a limit later
Section titled “Change a limit later”A budget’s limit, scope, window and on_breach are fixed once a run has used the budget. If you edit them in
the file, the next run is refused before it starts:
error: budget 'dana-monthly' already exists with a different limit, scope, window or on_breach than the configuration says; refusing to run with a limit you may not expectGive the changed budget a new id instead.
Troubleshooting
Section titled “Troubleshooting”| You see | Do this |
|---|---|
validate names a path under $.budgets |
A key is missing or a value is not allowed. The ids use lower-case letters, digits, - and _ |
refusing to run with a limit you may not expect |
You edited a budget that a run already used. Put the old values back and add the new limit under a new id |
budget hard stop on the first call |
The limit is below the worst-case cost of one call. Raise the limit, or make calls smaller: Limit model calls |
| A call is refused although no budget is used up | No budget applies to the call. A call with no applicable budget is refused. Add a budget for the agent, the run or the organization |
| A call is blocked for an unknown price | Set the price: Override a price |
Next steps
Section titled “Next steps”- Budgets: reservations, windows and prices.
- Limit model calls: cap the size of one call.
- Costs and savings: read what was spent.
- Configuration reference: every key of a budget.
Was this page helpful?