Idempotency registry: has key K already been done? Claim it, complete it, read the stored result
Shared memory for side-effecting operations across agents and retries. begin(key) answers proceed (you hold a short claim), wait (another owner is mid-flight), already_completed (returns the stored result pointer), or fingerprint_mismatch (same key, different operation). complete(key) records the result pointer; abandon(key) lets someone retry. The claim expires, so a crashed worker does not block the key forever. Never infers completion from a timeout: only complete() marks a key done.
What you get
A duplicate charge, email or order costs far more than one $0.005 check before the side effect.
Call it
Send the JSON body below to https://agents.writerslogic.com/api/v1/idempotency-registry. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.
curl -i -X POST https://agents.writerslogic.com/api/v1/idempotency-registry \
-H 'content-type: application/json' \
-d '{"op":"begin","key":"refund:ch_3Q1:2026-11-04","owner":"billing-agent-2","fingerprint":"sha256:4be1…","requestId":"ba2-refund-ch_3Q1"}'
Input
| Field | Type | Required | Description |
|---|---|---|---|
op | string; one of "begin", "complete", "abandon", "get" | yes | |
key | string | yes | Idempotency key, e.g. refund:ch_123:2026-11-04. |
owner | string; length 1..128 | no | Worker id; required for begin, complete and abandon. |
fingerprint | string; length 1..128 | no | Hash of the operation's identity fields; a later begin with a different fingerprint is refused. |
claimSeconds | integer; 1..3600 | no | How long a begin claim lasts; default 300. |
retentionHours | integer; 1..168 | no | How long a completed key is remembered; default 24. |
result | object | no | complete: where the outcome lives (do not store payloads here). |
tenantId | string | no | Required for API-key callers (namespaced as key:<tenantId>; keep it unguessable). Ignored when a wallet paid: the payer address is the tenant. |
requestId | string | no | Caller-chosen id for this mutation. A retry with the same id and same input returns the stored response (24 h) instead of applying twice; the same id with different input is rejected. Send one on every mutation you may retry: without it a retry is applied again (fleet-memory record appends a duplicate; a repeated spend-ledger commit or release answers NO_HOLD because the first call already took effect). |
Example request body
{
"op": "begin",
"key": "refund:ch_3Q1:2026-11-04",
"owner": "billing-agent-2",
"fingerprint": "sha256:4be1…",
"requestId": "ba2-refund-ch_3Q1"
}
Result
The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.
| Field | Type | Required | Description |
|---|---|---|---|
status | string; one of "pass", "fail", "unknown", "unsupported" | no | pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass. |
op | string | no | |
decision | string; one of "proceed", "wait", "already_completed", "fingerprint_mismatch", "recorded", "not_owner", "none" | no | |
state | one of | no | in_progress, completed, abandoned, or null when the key is unknown. |
owner | one of | no | |
claimExpiresAt | one of | no | |
completedAt | one of | no | |
stored | one of | no | The result recorded by complete(). |
witnesses | array<object> | no | |
versions | object | no | Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile). |
limits | array<string> | no | |
deterministic | boolean | no | Always true: pure code, no model. |
Pay and connect
Available through: x402 (USDC on Base), MCP. MCP clients reach it through the agent-coordination-kit package.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent