Policy library
Payments
Outbound payments, and adding someone new to pay. Money that leaves the company is the classic agent risk: a prompt injection that names a new payee and a large amount.
What it guards#
| Tool | When an agent calls it |
|---|---|
send_payment | To pay a supplier, contractor or customer |
add_payee | To save new bank details to pay later |
Params#
send_payment:
| Param | Type | Required | Meaning |
|---|---|---|---|
amount_minor | whole number | yes | The payment in minor units |
currency | string | yes | ISO code such as USD |
payee_is_new | boolean | yes | true if this payee was never paid before. Work it out in your code from your own records, not from what the model says |
add_payee needs no params. Send the payee's details anyway, so the person
who approves can see them.
Outcomes#
| Request | Outcome | Policy id |
|---|---|---|
| Known payee, up to $500 | allow | payment-known-payee |
| Any payee, up to $5,000 | ask_human | payment-needs-approval |
| New payee, over $1,000 | block | payment-new-payee-cap |
| Over $5,000 | block | payment-hard-cap |
| A currency not on the list | block | payment-currency |
| Would take today's total over $20,000 | block | payment-daily-budget |
add_payee, always | ask_human | add-payee-needs-approval |
Tune it#
- The limits are in
payment-known-payee(50000),payment-needs-approvalandpayment-hard-cap(500000, keep them equal) andpayment-new-payee-cap(100000). - Add currencies to
["USD"]inpayment-currencyonly with limits for each. 50000 yen is not 50000 cents. One way is a policy per currency:when { context.currency == "EUR" && context.amount_minor <= 45000 }. payment-daily-budgetreadscontext.spent_today_minor, which Riskbound fills from the agent's decisions today. The agent's owndaily_spend_cap_minordoes the same job outside policy. Use either; the policy version shows up in the decision's reasons.
The policy#
This is payments.cedar as it is in the repository.
// Outbound payments, and adding a new payee.
//
// Tool: send_payment
// Params: amount_minor (whole number, minor units), currency (string),
// payee_is_new (boolean: true if this payee was never paid before)
//
// known payee, up to $500 allow
// any payee, up to $5,000 ask a human
// new payee, over $1,000 block
// over $5,000 block
// a currency not on the list block
// more than $20,000 sent today block (uses spent_today_minor)
//
// Tool: add_payee
// Params: none required
//
// always ask a human
@id("payment-known-payee")
permit (principal, action == Action::"act", resource == Tool::"send_payment")
when { !context.payee_is_new && context.amount_minor <= 50000 };
@id("payment-needs-approval")
permit (principal, action == Action::"act_with_approval", resource == Tool::"send_payment")
when { context.amount_minor <= 500000 };
@id("payment-hard-cap")
forbid (principal, action, resource == Tool::"send_payment")
when { context.amount_minor > 500000 };
@id("payment-new-payee-cap")
forbid (principal, action, resource == Tool::"send_payment")
when { context.payee_is_new && context.amount_minor > 100000 };
// Limits are in minor units of one currency. A payment in any other
// currency would slip past them, so it is refused.
@id("payment-currency")
forbid (principal, action, resource == Tool::"send_payment")
unless { ["USD"].contains(context.currency) };
// spent_today_minor is set by Riskbound from the agent's decisions today.
@id("payment-daily-budget")
forbid (principal, action, resource == Tool::"send_payment")
when { context.spent_today_minor + context.amount_minor > 2000000 };
@id("add-payee-needs-approval")
permit (principal, action == Action::"act_with_approval", resource == Tool::"add_payee");