Expand description
The spend caps (docs/specs/SPEC_ROUTE_AGENT_BRAKES_2026_11_10.md section 3.2): how much an agent may use
through the gateway in a UTC day, and how much a route may. The gateway reads them at each request, so a
cap raised mid-turn lets the next request through.
- Per agent: the agent definition’s content
agent:spend_cap_usd. Absent is the app settingmodel:agent_spend_cap_usd(the default for every agent without a cap of its own), and absent thatDEFAULT_AGENT_CAP_USD;noneor0is no cap. - Per route: the app setting
model:spend_cap_usd:<route id>. Absent isDEFAULT_ROUTE_CAP_USD;noneor0is no cap. A route is the OpenRouter route or the Anthropic API-key route (super::catalog::KEY_ROUTE_ID); an agent on a login has plan limits and no cap.
Structs§
- Hit
- A cap that has been reached.
Enums§
- Scope
- What a cap was reached for.
Constants§
- AGENT_
CAP_ TYPE - The agent-definition content type the agent’s cap is kept under.
- DEFAULT_
AGENT_ CAP_ SETTING - The app setting the default per-agent cap is kept under.
- DEFAULT_
AGENT_ CAP_ USD - What an agent without a cap of its own may use in a day when the setting is not set.
- DEFAULT_
ROUTE_ CAP_ USD - What a route may be used for in a day when its setting is not set.
- MIN_
CAP_ USD - The least a cap may be set to: a smaller one is not a cap anyone meant.
- ROUTE_
CAP_ SETTING - The prefix of the app setting a route’s cap is kept under; the route id follows.
Functions§
- agent_
cap - The agent’s cap in dollars a day, or
Nonewhen it has none. - agent_
level - The alert level the agent’s day is at under its own cap; 0 when it has none.
- clear_
agent_ cap - Takes the agent’s own cap away, so it has the default again.
- default_
agent_ cap - The cap an agent has when it has none of its own: the setting, or
DEFAULT_AGENT_CAP_USD.Noneis no cap. - has_
own_ cap - Whether the agent has a cap of its own (a number or
none), and not the default. - level
- How far
spentis intocap, as the alert level it has passed: 0, 50, 80 or 100. - parse_
request - What
Agents update spend_cap_usdtakes: a positive number of dollars,0or"none"for no cap. - reached
- The cap the agent’s use today has reached, if any. The agent’s own is checked first.
- refusal_
text - The refusal the harness shows: what was used, what the cap is and who can lift it.
- route_
cap - The route’s cap in dollars a day, or
Nonewhen it has none. - set_
agent_ cap - Sets the agent’s cap:
Some(dollars), orNonefor no cap.