budget-guard: reserve
budget_reserve[budget-guard] Call BEFORE each model call, tool call or sub-agent spawn with your estimate. Returns allowed=true and deducts it, or allowed=false with the limit that tripped. When allowed is false, stop, do not retry, and return your partial result to the user. Atomic, so parallel sub-agents cannot both slip under the cap.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"handle": "<handle>"
},
"name": "budget_reserve"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| usd | No | Estimated cost of the next call in USD. | |
| note | No | Short note, e.g. "web_search #12". | |
| calls | No | Number of calls to reserve (default 1). | |
| handle | Yes | The budget handle from open_budget (looks like bg_<id>.<secret>). Pass it to every sub-agent so they all spend from the same budget. | |
| tokens | No | Estimated tokens of the next call. |