Idempotency registry: has key K already been done? Claim it, complete it, read the stored result

$0.005 USDC per call · Agent infrastructure · POST /api/v1/idempotency-registry · Id idempotency-registry

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

FieldTypeRequiredDescription
opstring; one of "begin", "complete", "abandon", "get"yes
keystringyesIdempotency key, e.g. refund:ch_123:2026-11-04.
ownerstring; length 1..128noWorker id; required for begin, complete and abandon.
fingerprintstring; length 1..128noHash of the operation's identity fields; a later begin with a different fingerprint is refused.
claimSecondsinteger; 1..3600noHow long a begin claim lasts; default 300.
retentionHoursinteger; 1..168noHow long a completed key is remembered; default 24.
resultobjectnocomplete: where the outcome lives (do not store payloads here).
tenantIdstringnoRequired for API-key callers (namespaced as key:<tenantId>; keep it unguessable). Ignored when a wallet paid: the payer address is the tenant.
requestIdstringnoCaller-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.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: 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.
opstringno
decisionstring; one of "proceed", "wait", "already_completed", "fingerprint_mismatch", "recorded", "not_owner", "none"no
stateone ofnoin_progress, completed, abandoned, or null when the key is unknown.
ownerone ofno
claimExpiresAtone ofno
completedAtone ofno
storedone ofnoThe result recorded by complete().
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways 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