Answers · agent payments
How do I get an alert when an AI agent approaches its spend cap, before the hard deny?
Last updated
TL;DR: Hard spend caps (per purchase, per day, per task) correctly deny the next authorize_spend once the total would pass the limit — but by then the owner only hears about it as a failed payment. Soft thresholds sit below the hard cap (for example 50%, 80% and 90% of daily_max_minor or of a per-task budget): when spent_today_minor or the task total crosses a soft line, notify owners, optionally open a raise path with request_human_approval, and keep the hard cap in force so authorize_spend still denies over the ceiling. That is distinct from per-request and per-run caps, task-scoped spend policies and wallet gating pages, which are the hard limits themselves. set_spend_policy installs the hard cap; authorize_spend enforces it; request_human_approval is the raise path; ledger_verify keeps both soft alerts and hard denies checkable.
What should I check, step by step?
1. Set the hard cap first with set_spend_policy: currency, per_tx_max_minor, daily_max_minor, allowed_domains/categories, optional expires_at. Soft alerts without a hard deny behind them are only noise.
- Define soft thresholds as fractions of that hard cap (for example 0.50, 0.80, 0.90 of daily_max_minor, and the same for a per-task budget if you track one). Store them outside the agent's editable session.
- After every authorize_spend allow (or on a short poll of GET /v1/spend/policies/{credential_id}), compare spent_today_minor to each soft line. Fire once per threshold per UTC day (or per task), not on every subsequent purchase.
- On a soft hit: notify owners (pager, chat, email) with credential id, spent vs cap, merchant and reference. Do not auto-raise the cap from the agent.
- Offer a raise path only through a human: request_human_approval bound to the new proposed daily_max_minor / per_tx_max_minor and policy version; after approve, call set_spend_policy again. Until then the hard cap still denies.
- Keep authorize_spend as the execution boundary: over_per_transaction_cap and over_daily_cap must still return signed denies even if soft alerts failed or were ignored.
- Record soft-threshold events and hard denies on an append-only ledger the agent cannot rewrite, with policy_id, policy_version, spent, cap and threshold.
- Drill it: run spend to 80% and confirm one alert; push past the hard cap and confirm deny; approve a raise and confirm the new policy version is what authorize_spend uses.
What is the difference between a soft spend threshold and a hard spend cap for an AI agent?
A soft threshold is a notification and an optional re-approval path, not a second allow. At 80% of a $100 daily cap you want a page or a human looking at the run; at 101% authorize_spend must still return over_daily_cap.
- Provider consoles (OpenAI project monthly limits, Claude workspace limits, OpenRouter key limits) are hard ceilings with little or no soft warning you control. Put soft lines in your own monitor that reads Rightshold's running total so you are not surprised by a hard deny mid-task.
- How to set per-request and per-run spend caps, how to give each AI agent a task-scoped spend policy, and how to gate an agent wallet with per-task caps cover the hard limits. This page is the early-warning layer in front of them.
How do I wire soft spend alerts off the same totals authorize_spend uses?
set_spend_policy stores per_tx_max_minor and daily_max_minor on the credential. authorize_spend checks the proposed amount against those caps and the running daily total (UTC day) and returns a signed allow or deny with reasons.
- GET /v1/spend/policies/{credential_id} (owner key) shows the policy and spent_today_minor. Your alerter should use that same spent figure (or the sum of allows you already recorded for the task) so soft lines and hard denies cannot disagree.
- Debounce: emit one event per threshold crossing per window. Pair the alert with the purchase reference and merchant_domain from the last allow so on-call can see what is burning the budget.
How do I raise an AI agent's spend cap after a soft threshold alert?
When a soft threshold means "consider raising," do not let the agent rewrite its own cap. request_human_approval with an action that names the credential, current cap, proposed cap and policy_version; after decide_human_approval, call set_spend_policy with the new numbers.
- Until that approval lands, authorize_spend keeps denying over the old hard cap. That is the point: soft alerts buy time for a person; they do not punch a hole in the ceiling.
- ledger_verify is free and keyless for the chain of policy changes, soft-threshold records and hard denies. EU AI Act Article 14 expects human oversight that can intervene; a soft alert plus a bound raise approval is that oversight for spend.
How do I ask Rightshold about this (free, no key)?
Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “Set a hard daily spend cap of 100.00 USD on my agent credential (10.00 per purchase), and tell me how to alert at 50%, 80% and 90% of that cap before authorize_spend starts denying.”
{
"tool": "set_spend_policy",
"arguments": {
"credential_id": "crd_YOUR_AGENT_CREDENTIAL",
"currency": "USD",
"per_tx_max_minor": 1000,
"daily_max_minor": 10000,
"allowed_domains": [
"api.example.com"
],
"allowed_categories": [
"data_api"
]
}
}- Needs your owner account key; it's in the trust toolset (connect to /mcp?toolset=trust). set_spend_policy installs the hard cap; soft percentages are your monitor comparing spent_today_minor to daily_max_minor.
- authorize_spend returns a signed allow or deny against that hard cap; over_daily_cap and over_per_transaction_cap still deny even if soft alerts were missed.
- request_human_approval binds a raise of the cap to a human decision; verify_human_approval is free before you call set_spend_policy again.
- ledger_verify is free and keyless for policy changes and spend decisions.
Rightshold records spending policies and signed allow/deny decisions; it never holds or moves money. Soft-threshold notifications, paging and auto-open of a raise approval are workflow you build around GET /v1/spend/policies and authorize_spend — Rightshold does not send those alerts itself. Not financial or legal advice.
What are the sources?
- NIST SP 800-53 Rev. 5: SI-4 (system monitoring) and AU-5 (response to audit logging process failures)
- RFC 6962: Certificate Transparency (append-only Merkle hash logs)
- EU AI Act, Regulation (EU) 2024/1689: Article 14 (human oversight)
- Agent spending policies on Rightshold
- Human approvals on Rightshold
Related
- How to set per-request and per-run spend caps for x402 agent payments
- How to give each AI agent a task-scoped spend policy with auto-expiring approvals
- How to gate an agent wallet or card with per-task caps and an outside-agent spend record
- How to enforce AI agent payment caps at the execution boundary not in the prompt
Not legal advice. JSON · Markdown · All answers
Get a free API key in one call
No card and no email needed. 100 free credits; the license and policy checks stay free without a key.
curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_... # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
-H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'
