Mandate · Guide
Set sub-agent limits
Use this when your agents hand grants to sub-agents and you want one set of limits for all of them: the most a parent hands on in all, how sub-agents share it, which kinds of merchant and which merchants they may buy from, and what happens past a cap. Reject first, then ask a person.
Before you begin: your agents delegate (see delegate to subagents).
1. Save your limits
PUT / saves the limits as a new live version. Export the sandbox account key first:
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT $PROVENANCE_API/v1/mandate/settings/limits \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": {
"cap": { "enabled": true, "amount": 2400, "currency": "USD" },
"budget": { "allocation": "shared", "at_limit": "continue" },
"allowed_mcc": { "enabled": true, "action": "refuse", "mcc": [{ "group": "airlines" }, { "group": "lodging" }, { "group": "car_rental" }] },
"named_merchants": { "enabled": false, "action": "refuse", "merchants": [] },
"blocked_mcc": { "enabled": false, "mcc": [] },
"blocked_merchants": { "enabled": false, "merchants": [] },
"refuse_over_cap": { "enabled": true, "unit": "percent", "value": 20 },
"ask_over_cap": { "enabled": true },
"refuse_over_share": { "enabled": false, "unit": "percent", "value": 20 }
}
}'
const current = await prov.mandate.grants.limits();
await prov.mandate.grants.setLimits({ ...current.document, cap: { enabled: true, amount: 2400, currency: "USD" } });
current = prov.mandate.grants.limits()
prov.mandate.grants.set_limits({**current["document"], "cap": {"enabled": True, "amount": 2400, "currency": "USD"}})
| Row | What it is | When it's on |
|---|---|---|
cap | The most a parent hands its sub-agents in all | Each delegation's budget, with the parent's live children's, stays within it |
budget | allocation: shared (Flexible share) or reserved (Reserved); at_: stop, ask or continue (Keep going) | The budget settings each sub-agent gets when its delegation doesn't say |
allowed_ | Kinds of merchant, by group or MCC range | Any other kind is refused (or asked, action: "ask") |
named_ | Merchants by ID or origin | Any other merchant is refused (or asked) |
blocked_, blocked_ | Kinds of merchant and merchants | Always refused |
refuse_ | A margin past a budget: a percentage (20% by default) or a fixed amount | Past it, refused without asking |
ask_ | Asking a person | Below the margin, a person is asked; off, refused at the budget |
refuse_ | With at_, a margin past a sub-agent's own limit | Past it, refused without asking; off, a person is asked at any amount over |
Until you save a version, GET / answers the built-in limits (is_default: true), which apply nothing.
2. Know what a published version does
| What | How |
|---|---|
| Your account's over-limit settings | The cap rows (and the merchant rows, when on) become your account's settings for those locks, as PUT / would. A grant's own settings still come first |
| Each new delegation | POST / and a delegation proposal hand each sub-agent the budget settings (its allocation, and stop or ask as its own budget setting), the allow lists (when its parent has none) and the block lists, wherever the request leaves them out. What the request states wins |
| The overall cap | A delegation that would take the sub-agents' budgets past the cap is refused, 400 mandate_, with what's left in error. |
| The record | Every publish writes an audit row and sends mandate.; the delegation's ledger row records mandate_ |
A running grant keeps what it was handed: a later publish changes the next delegation, not the last one.
3. Let your team change them in your admin
Mint a rules session with object_id: "mandate_limits" and drop <provenance-rules> into your admin. Your team sees "Mandate rules", changes the cap or the margin within your bounds, saves a draft and publishes. See the rules component for the scope and loadValues. A draft waits until someone publishes it: POST /, a publish session, or the console.
4. Try a draft in sandbox
A sandbox session minted with rules.draft_group saves its drafts in that group. Add the draft's version and its group ("limits_version": 7, "draft_group": "visitor-4f2a") to the body of a delegation or a proposal to apply that draft instead of the live limits.
In live, limits_version is 400. A draft of another group is 400 too, so one visitor's call can't use another's.
Errors you might see
| Error | Why |
|---|---|
policy_ | A list row is on with no list, an unknown key, or a percentage over 1000 |
mandate_ | The sub-agents' budgets together would pass the cap, or a sub-agent under a cap has no budget |
rules_ | A session changed a row or a value its scope doesn't allow |