Most teams that let an AI agent issue refunds start with a simple guardrail: a per-action limit. Each refund the agent issues has to stay under some amount, and anything bigger goes to a person.
That limit is useful, but it answers the wrong question. It tells you how much a single refund can be. It doesn't tell you how much a single order can lose.
Where per-action limits break
Picture an order that's been touched by more than one automated path. A support agent handles the chat. A returns agent processes the return label. A billing agent cleans up a duplicate charge. Each one stays inside its own limit, and each one decides a refund is reasonable.
Three refunds of $100 on the same order is still $300 out the door, and no single rule was broken.
The same thing happens with one agent, too. If a customer opens three chats about the same order, or a retry runs after a timeout, each run sees a fresh request and applies the same per-action check. Nothing in that check knows what already happened.
What a per-order cap looks like
The fix is to make the limit about the order, not the action:
- Keep a running total. Before any refund, look up how much has already been refunded or credited on that order, across every agent and every person.
- Check the total, not the amount. The question becomes "would this push the order past its cap?" rather than "is this refund under the limit?"
- Put the check where all paths meet. If the cap lives in one agent's instructions, the other agents never see it. It belongs in the shared tool or service that actually issues the money.
- Route the overflow to a person. When a refund would cross the cap, the agent stops and hands off with the order history attached.
Store credits, gift cards, and shipping refunds count too. If they're tracked separately, the total is wrong.
A small first step
You don't need a new system to start. Write down your total refund cap per order, in one sentence, and check whether every refund path, automated or human, can actually see it. If the answer is "only some of them," that's the gap to close first.
Questions for you
If you run agents that can move money, I'm curious how you've handled this:
- Do you enforce limits per action, per order, per customer, or some mix?
- Where does the check live: in the agent's tools, the payment layer, or an approval step?
- How do you account for retries and duplicate conversations?
Disclosure: I run AgentRisk, a written risk report for customer-facing AI agents. This post is adapted from one of the short risk tips I publish. More at https://rleffke.com/agentrisk
Top comments (2)
Putting the running total inside the shared payment service is necessary, though two race conditions still slip past a naive "read total, check cap, issue refund" flow. If a support agent and a billing agent hit the same order simultaneously, or a timeout triggers an automatic retry, both reads see the old total before either payout settles.
In practice that check has to be atomic on the order row itself, either via
SELECT ... FOR UPDATEor a conditional ledger update that enforcesrefunded_cents + delta <= cap_centsin the same transaction, paired with a deterministic idempotency key per refund intent so retries replay the original outcome instead of opening a second payout. Tracking the ledger in integer cents also avoids small rounding discrepancies when partial shipping and tax refunds stack up.The retry after a timeout example is the one that would worry me most. A running total only helps if the check and the write happen together. Otherwise two refunds landing at the same moment both read the old total and both pass.
Reserving the amount against the order in the same transaction as the check, plus an idempotency key per refund request, closes that gap.
Do you count pending refunds toward the cap, or only settled ones?