Cost cap¶
One ledger scalar per agent, cost_cap_usd, in US dollars — 250 or 250.50, not cents.
It is unset on every agent unless you set it, and unset means no check ever runs. There is no
fleet-wide default and no implied ceiling.
agentctl agents set noor cost_cap_usd 500 # live immediately — no apply, no restart
agentctl agents set noor cost_cap_usd 1000 # raise it: the next turn/subsession/tick goes through
agentctl agents set noor cost_cap_usd "" # clear it: back to no cap at all
0 and any negative value also mean no cap. agents set rejects a value that would not
parse. There is no verb that prints a cap back: read it from the cockpit's Fleet app, from
agentctl agents roster --json, or from the ledger.
Setting the key writes AGENTCTL_COST_CAP_USD into the agent's own
~/.config/agentctl/agent.env straight away, which is why no apply is needed — the ledger
itself is root-only, and two of the three checks below read the cap from that file.
The three choke points¶
When the cap is set and the agent's persisted spend has reached or passed it, three independent choke points refuse new model work. Each carries its own check.
| choke point | how it refuses |
|---|---|
an inbound turn (a channel message or agentctl inject) |
answers the owner on their channel and injects nothing |
subsession start / subsession resume |
stderr and exit 1, before the drop-in is written and before systemctl start |
| a cron tick | logs it and exits 0 rather than failing the unit |
All three notify the owner directly. No unit is stopped or disabled: the agent keeps running and every other verb keeps working, so lifting the cap takes effect on the next check.
Behaviour¶
| property | detail |
|---|---|
| daily | resets at local midnight; a prior day's spend never counts against today |
| source | today's days[] entry in ~<agent>/workspace/.cache/fleet-usage-rollup.json |
| up to an hour stale | the rollup runs roughly hourly, so an agent can cross its cap and keep working |
| fails open | no cap, an unparseable cap, a missing or corrupt rollup — all proceed |
| not a containment boundary | two of the three checks run as the agent's own user, against agent-readable state |
The hourly usage rollup is the only thing that prices tokens; no check re-derives a cost.
Where the cockpit shows it¶
Read-only, in the Fleet app, in two places. Setting a cap stays a CLI action.
| surface | what it shows |
|---|---|
Agents table, cap column |
blank when uncapped, $50 when capped, bad in the warn tone when unparseable |
Usage tab, cost caps section |
$34.20 spent / $50.00 cap per capped agent, closest-to-the-cap first |
Once spend reaches the ceiling, the row's bar turns red, its label gains ≥ cap, and the
section leads with AT OR OVER THE CAP: <agents>. A capped agent whose rollup is missing is
listed as cap not enforced. The section sums today's spend only and ignores the tab's
7d/30d/90d picker, because today is what the three checks compare against.