Rightshold™ Sign up

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.

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.

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.

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.”

One-click setup

{
  "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"
    ]
  }
}

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?

Related

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}}'