AGENT RETRY GUARD
Free local SDK · v0.1.1 · Node.js 24+

A timeout shouldn’t become a second purchase.

Give your agent a durable operation record. Reuse confirmed results. Reject changed requests. Stop when the outcome is uncertain.

No signup. No card. No npm dependencies. Local SQLite.

operation: order-1001 / purchase

01 CLAIM
Persist intent before calling the tool.

02 RESPONSE LOST
Was the purchase completed?

03 CHECK LOCAL STATE
Confirmed → replay result
Uncertain → stop and reconcile

Stable business operation keyKept across agent retries and restarts.
One persistent local ledgerConcurrent processes share the same SQLite file.
Explicit uncertaintyNo automatic retry of an ambiguous effect.
See the decision

Should the agent try again?

This browser simulation uses the SDK’s decision function. Run the downloaded demo to test real SQLite persistence and restart behavior.

Mock effects after retry: —
Choose a scenario. No real payment is made.
From download to first result

Extract. Run. Inspect.

With Node.js 24+ installed, extract the SDK ZIP and run these commands inside its folder.

node demo.mjs
node --test guard.test.mjs mcp-demo.test.mjs

The offline demo simulates a purchase, reopens its SQLite ledger, checks result replay, and blocks an uncertain retry. It makes no network calls.

Or connect the included local MCP demo

Use this configuration in a stdio-capable MCP client after replacing the two absolute paths. The demo uses mock purchases only and opens no network port.

{
  "mcpServers": {
    "agent-retry-guard-demo": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/mcp-demo.mjs", "--state-dir", "/PRIVATE/LOCAL/PATH/demo-state"]
    }
  }
}

Call retry_guard_demo_purchase twice with the same order ID and amount. Expect one mock effect. Use a new order with mode: "lose_response" to test an uncertain operation. Full instructions and limitations.

Wrap the actual tool implementation

import { RetryGuard } from './guard.mjs';
const guard = new RetryGuard({
  filename: './operations.sqlite', scope: 'company-123:production'
});
const result = await guard.run({
  key: 'order-1001:purchase', action: 'merchant.example/purchase:v1',
  input: { amountMinor: 50, currency: 'USD', productId: 'report-12' }
}, async ({ idempotencyKey }) => {
  // Replace with your provider call; forward its idempotency key if supported.
  return { receiptId: 'mock-only', idempotencyKey };
});

Read integration, reconciliation and deployment instructions →

A precise boundary, not an exactly-once payment guarantee.
All relevant calls must pass through this guard using the same stable key, scope and persistent local database. Separate hosts or files are not coordinated. It does not hold funds, control a wallet, verify receipts or reverse a payment. Successful results are stored locally in plaintext; return minimal receipts.
Start free. Validate the need.

A useful local edition today.

AVAILABLE · MIT SOURCE

Local developer edition

€0 no expiry

Durable claims, stored JSON result replay, conflict detection and explicit uncertain states on one trusted host. SDK contains no telemetry.

Get v0.1.1

File hashes & package contents

RESEARCH · NOT AVAILABLE

Managed team edition

€9 / month · proposed entry price

Proposed shared multi-host coordination and operator workflows. Not implemented or sold in this release. No preorder, subscription or future payment obligation.

Request a team pilot by email

Opens a draft in your own email app; nothing is sent automatically. Requests are non-binding and create no subscription or marketing signup. Do not include credentials or private logs. GitHub feedback is also available.

Built around a documented failure mode.

A lost response can leave a tool’s external effect ambiguous. A fresh request ID does not identify the original business operation.

MCP reproduction and its limitations · x402 application-level idempotency discussion

Existing alternatives and upstream fixes exist. This SDK is a small application-layer option, not a claim that MCP or x402 universally duplicate payments. A local MCP stdio demo with mock purchases is included. A production payment adapter and native x402 integration are not included.