Spend caps
Price an MCP server and set a cap.
Your research agent gets stuck calling a priced search tool at 3 a.m. The call that crosses its $0.50 run cap is the last one through, and the run stops. Once the day’s $5.00 is spent, the next run won’t start.
How it works
Give each priced MCP server its price in the Agentfile, then set max_per_run_usd and max_per_day_usd. Priced tool calls that pass through the gate are metered against that price. The daily ledger lasts across runs and is keyed by the agent’s identity, so renaming the agent doesn’t reset it.
pricing:
meters:
- usage_path: result.usage.input_tokens
usd_per_unit: "0.000003"
spending:
max_per_run_usd: "0.50"
max_per_day_usd: "5.00"How spending is counted.
Constle moves no money. For calls that pass through the gate, it multiplies the usage each priced server reports by the price you set, and stops the run once the total passes a cap you set. A server that under-reports its usage lowers the figure. Your provider’s bill is the source of truth.
One at a time.
Priced tool calls go one at a time, so two can’t race past a cap in one run. A priced result with no usage value ends the run, so a server can’t zero its own count by leaving the value out. Error replies aren’t charged.
Where it stops.
It counts calls that pass through the gate to servers you price, not your model bill. Direct calls to a model API go to hosts you allow, not through the gate, so they aren’t metered. The call that crosses a cap still runs and is counted, and each overlapping run of one identity can pass the daily cap by one call.
Traffic to hosts you allow isn’t gated. If an allowed host shares a server with a priced MCP server, a request can reach that MCP server past the gate, unmetered. On a priced server, methods you list under methods (such as resources/read) go through unmetered.
The daily cap needs an identity and a priced MCP server. A monthly cap is warned about, not enforced. Pair it with a usage limit on your model key, if your provider offers one, and with max_duration_seconds.
Does it count LLM tokens?
Only when they’re billed through a priced MCP server, on calls that pass through the gate. Direct model-API traffic isn’t metered.
Can the agent reset the daily cap?
No. The ledger lives on the host, keyed by the agent’s identity, and a rename can’t reset it.
What happens at the cap?
The call that crosses it is counted, the run stops, and a spending_limit_reached event goes in the log.
What if I set a cap with nothing priced?
constle validate says the cap won’t be enforced.
Spend caps for priced tools (guide) → Spend caps and metering (docs) ↗
The current source and its signed releases aren’t public yet.