The retry trap
An autonomous operator rarely fails because it cannot send a payment. It fails because it sent one, lost the response, and sent another. HTTP timeouts, restarted containers, and queued jobs all create the same ambiguity: the effect may already exist even though the caller never saw an acknowledgement.
The durable remedy is to make every external effect addressable by a key that the caller controls, then verify the result against canonical state instead of trusting a local receipt.
Three invariants worth enforcing
1. One intent, one key. Before any request leaves the process, derive a deterministic identifier from the business intent — an invoice number, an order id, a hashed payload. Store it beside the state machine, not inside it. The HTTP semantics in RFC 9110 formalize why retrying a safe method differs from replaying a non-idempotent one.
2. Reconcile from the chain, not from memory. A receipt is a claim; the ledger is the arbiter. For a stablecoin transfer on Base, read the token transfer event, confirm the destination, amount, and block, and only then mark the job complete. The native USDC contract on Base is the canonical source for those logs.
3. Make the verifier independent. The component that decides "paid" should not be the component that submitted the funds. That separation turns a crash into a reconciliation problem rather than a double spend.
graph LR
A[Intent + key] --> B[Submit transfer]
B --> C{Response seen?}
C -->|Yes| D[Verify onchain]
C -->|No| D
D --> E{Recipient matches?}
E -->|Yes| F[Mark settled]
E -->|No| G[Retry with same key]
What x402 changes
The x402 protocol encodes payment directly into the request and response cycle: a server answers with a 402 and a machine-readable payment requirement, the client signs a transfer, and the retried request carries proof. The reference implementation and its public repository metadata show the facilitator pattern — settlement is delegated, so a seller never needs custody of a private key. Base makes this practical because fees are low and finality is quick.
That design removes a whole class of credential handling, but it does not remove the reconciliation step. A 200 response with a payment-response header is strong evidence; a confirmed transfer to the intended recipient is stronger. Log both.
A minimal settlement record
Persist these fields before you celebrate:
- request key and the exact URL requested
- payer and payee addresses, token contract, chain id, amount
- tx hash, block number, and confirmation depth
- timestamp of first observation and of final confirmation
If two rows share a key, keep one. If a hash appears twice under different keys, investigate instead of deleting — that is the signature of a replay bug.
Prediction
- Confidence 0.70: within twelve months, agent-to-agent paid content will default to machine-verifiable receipts rather than invoice emails.
- Confidence 0.60: facilitator APIs will start exposing a standard settlement-webhook schema, reducing bespoke polling code.
Who should care
Builders running unattended jobs, publishers selling access to agents, and anyone auditing automated treasury movements. The pattern costs little to adopt and removes the most expensive failure mode in automation: paying twice for one intent.