A working experiment in paid API reliability
A retry shouldn’t
cost you twice.
Timeouts. Lost replies. Crashes. A simple retry can charge you again. This runner records every purchase before it happens, then checks what was really charged.
Break a worker. Restart it. Follow the money.
Set the conditions
Five sample translation jobs. $0.10 each.
A local fictional provider; no real purchases.
Daily budget
$2.00 cap- Spent $0.00
- Reserved $0.00
- Unresolved $0.00
The cost of guessing.
Ready when you areRun the experiment. These numbers will come from actual local provider calls.
Simple retry
Retries uncertain purchases.
Paid Job Runner
Checks before buying again.
| Run | Simple retry | Paid Job Runner |
|---|---|---|
| All runs |
No experiment yet. No claimed savings.
Every job leaves a trail.
Budget approved → call reserved → provider accepted → receipt saved → result saved → charge recorded.
Your five job tracks will appear here. A crash leaves a visible stop point; recovery adds evidence to the same track.
No unresolved purchases.
Two records. Check the match.
The provider keeps its own charge ledger. The runner keeps its own reservations and settlements. A missing receipt never means “no charge.” For contrast, the simple-retry baseline sends the same jobs without checking first; the provider bills it on a separate account.
The two ledgers are empty.
Provider’s ledger What was charged
Runner’s ledger What is accounted for
Simple-retry baseline Same jobs, no checks
04 / Audit logFollow the append-only records.
Plain labels below describe the stored events. The API keeps the original identifiers. Records contain no provider keys or raw errors.
- No events yet.
05 / Under the hoodThe guarantees, and their boundaries.
Before money moves
Admission is counted before any paid call. The reservation is written before the call, so a restart has a durable starting point.
Evidence before a retry
Receipts are tamper-evident with HMAC-SHA256, not encrypted. Recovery checks receipts and the provider’s records. A missing receipt never means “no charge.” Without proof, the purchase stays held.
Durable records, bounded recovery
Audit segments are append-only. POSIX file leases guard against racing processes. Recovery is bounded and refuses unsafe replays.
A narrow boundary
Closed result envelopes expose named outcomes and job handles, with no keys or raw errors. The MCP tool server lets AI agents submit jobs and check status; the provider key never enters the agent.
Exercised, not assumed
Loading the recorded test counts…
Small on purpose
Python 3.14 standard library. Zero runtime dependencies. The page uses local HTML, CSS, and JavaScript with no build step.
This demo proves the fictional provider contract. A provider without a reliable charge lookup can leave a purchase unresolved.
06 / AI agent accessA real MCP request and response.
Recorded from the test client
No provider key. No provider address.
The client submits one invented job, then asks for its status. These messages are saved by the scripted MCP integration test, without rewriting the responses.