budget_spend
Deduct tokens from the FederatedBudget for an agent's LLM call. Returns approval with spent and remaining, or denial when budget ceiling would be exceeded.
Instructions
Deduct tokens from the global FederatedBudget on behalf of an agent. Returns {ok:true, allowed:true, spent, remaining} when approved, or {ok:true, allowed:false, deniedReason, remaining} when the ceiling would be exceeded. Returns {ok:false, error:"..."} if tokens is not a positive integer. tokens represents the estimated cost of the upcoming LLM call — pass the expected usage before invoking the model; agent_id is tracked individually in the spend log and reported by budget_status. Call budget_status first to check remaining balance; never attempt an LLM call after receiving allowed:false.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent spending tokens | |
| tokens | Yes | Number of tokens to spend (positive integer) |