Treasurer
Owns the budget rule, spend accounting and pricing, plus factory cloud spend and the compute inventory. The Treasurer answers one question, whether an agent is inside its limits, and every other member enforces the answer.
- Design rules
- E5, E7, M3
- Contracts offered
- 2
- Key flows
- 4
On the job
- Answers standing for an agent: per run, per day, per month
- Prices each model call from the Executive’s token counts
- Reports cloud spend and compute inventory with a read-only role
- Stores budgets an admin sets, with no default budget
Not my job
- Block anything itself. Callers enforce: 402, blockRun, budget.alert.
- Count tokens. That is the Executive.
What Treasurer does, step by step
Answer: is this agent in good standing?
checkStanding is asked before a model call, before a wake, before a message goes into a live run, on ledger ingest and on a policy update.
The caller passes the agent’s limits and its spend for the run, the day and the month.
The Treasurer compares them and returns ok, or the first window exceeded: perRun, perDay or perMonth.
The caller enforces: the Landlord returns 402, the egress refuses the call, the control plane raises budget.alert.
The refusal is ledgered with the window.
Price a model call
The Executive counts; the Treasurer prices.
The Executive reports input, output, cacheRead and cacheWrite tokens.
priceFor finds the model’s price and costUsd turns the tokens into dollars.
The cost is added to the agent’s run, day and month spend.
Set a budget
There is no default. Until an admin sets one, nothing is enforced for that agent or for the factory.
An admin sends PUT /api/v1/spend/budgets.
validateBudgetLimits rejects anything that is not a positive number.
The change is ledgered.
Report cloud spend and compute
Model spend and infrastructure spend in one view.
A dedicated read-only role reads the provider’s cost and compute inventory. Agents never hold it.
Spend is attributed to agents and to the factory. Budgets are evaluated on gross usage, before credits.
The console reads GET /api/v1/spend/report and /spend/compute.
Contracts Treasurer keeps 2 offered
- checkStandingused by Gatekeeper, Landlord
- costUsd / priceForused by Executive, Gatekeeper