Give an agent a budget it cannot overrun.
Think of reservations like a hold on a card. Money is committed before it is paid, so two purchases cannot both claim the same remaining budget. Try the three steps yourself.
Try the numbers ↓Reserve before paying.
The agent asks to set aside an amount. The policy checks both finalized spend and pending commitments. A request that exceeds the remaining budget is blocked before the balance changes.
Finalize or release.
Confirming a payment moves its amount from reserved to spent. Canceling it releases the hold. Neither action creates extra budget. This example allows one pending reservation at a time.
Keep the invariant true.
An invariant is a rule that must remain true after every step. Here that rule is spent + reserved ≤ budget. A production wallet would also check per-agent and global budgets in the same atomic transition.
Available = budget − already spent − reserved
A worked example
Start with $10,000 and $2,000 already spent. Reserve $3,000: $5,000 remains available. Pay the reservation: spent becomes $5,000, reserved returns to $0, and available stays at $5,000.