budget_spend
Deduct tokens from a shared budget for an agent's LLM call, verifying ceiling compliance. Returns approval with spent amount or denial with reason.
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 |
|---|---|---|---|
| tokens | Yes | Number of tokens to spend (positive integer) | |
| agent_id | Yes | The agent spending tokens |