Rightshold™ Sign up

Answers · agent payments

How do I give each AI agent its own spend policy that expires with the task, plus per-task caps and auto-expiring approvals?

Last updated

TL;DR: Make the spend policy an object with a lifetime, not a standing setting. For each agent and task: issue a separate credential, attach a policy with a per-purchase cap, a total for the task, an allowlist of merchants or categories, and an expires_at that matches the task's end. Have the agent check every purchase against that policy at payment time. When the task ends, the policy expires and further purchases are denied by default, with no one needing to remember to turn it off. Anything over the cap goes to a human as a one-time approval with a short expiry, bound to the exact amount and payee, so a yes can't be reused for a later or larger charge. Keep the policy versions, decisions and approvals outside the agent's editable session so the agent can't raise its own limits.

What should I check, step by step?

1. One credential per agent (and per task if tasks run in parallel). A shared key means shared caps, and revoking it stops everything.

  1. Write the policy per credential: currency, per-purchase max, a total for the task (or daily max for short tasks), allowed merchant domains and categories, and expires_at set to the task deadline.
  2. Fail closed: no policy, an expired policy, or a revoked credential means deny, not allow with a warning.
  3. Check at payment time, not at plan time: the agent (or your payment hook) asks for an allow/deny decision with the exact amount and merchant right before paying, and aborts on deny.
  4. Above the cap, request a one-time human approval bound to a hash of the exact purchase (amount, currency, merchant, item) with a short expiry, for example 15 to 60 minutes. Don't raise the policy for the rest of the task.
  5. Before paying on an approval, verify the decision receipt matches the purchase. A changed amount or payee needs a new approval.
  6. When the task finishes early, revoke the credential or set a new policy that expires now. Don't wait for the clock.
  7. Keep every policy version, allow/deny decision and approval in a store the agent can't edit, so you can show later what limit applied to each charge.

Why should an agent's spend policy expire with the task?

Standing budgets outlive the work they were meant for. An agent given $50/day for a research task still has $50/day next week, unless someone removes it.

How do I check per-task caps at payment time?

A cap written in the prompt or a config file the agent can edit is advice, not a cap. The check has to run outside the agent and return a decision the payment step obeys.

How do I make agent spend approvals expire and not be reused?

Bind each approval to a hash of the exact action. If the agent later wants a different amount, payee or item, the hash won't match and the old yes doesn't apply.

What can go wrong?

The task ends but the agent's policy doesn't; a later prompt injection spends the leftover budget.

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 spending policy on my research agent's credential for this task only: at most 2.00 USD per purchase and 15.00 USD a day, only at api.example-data.com, expiring when the task ends tonight at 23:59 UTC.”

One-click setup

{
  "tool": "set_spend_policy",
  "arguments": {
    "credential_id": "<this agent's credential id>",
    "currency": "USD",
    "per_tx_max_minor": 200,
    "daily_max_minor": 1500,
    "allowed_domains": [
      "api.example-data.com"
    ],
    "expires_at": "2026-11-07T23:59:00Z"
  }
}

Rightshold records spend policies, allow/deny decisions and human approvals for agents that call it, and signs each one. It never moves money, doesn't sit between your agent and the merchant, and can't stop a payment your code makes without checking. Enforce the decision in your payment hook and put hard limits on the card or wallet too. Not financial 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}}'