Skip to main content
The example agent works failed-payment tickets. It reads the ticket and the account, charges the amount due, and replies; an expired card goes to a person. When a charge times out, it tries once more. It calls no model.

Run it

Output

Timeouts on purpose

Two cases carry a condition: the billing system’s charge times out on the first call.
The twin answers that call with a timeout. The charge that timed out counts as attempted, not done, so the agent’s retry is the one effect in the ledger, and the default effect checks pass.

A check you write

What the default checks cannot see is that the retry was unsafe: in the real world a timed-out charge may have gone through, and a second charge with nothing to tell the two apart charges the customer twice. The example’s own deterministic check catches it:
Selectors read the lap’s record (its tool calls, effects, messages and answer). proving checks test <check> --lap <lap> shows what a selector picks on a real lap. The format is on Checks.

Fix it

Send the same idempotency key on every attempt of one charge, for example the ticket’s id: