DocumentationComparison
Why Idempotency Keys Aren't Enough

Stripe vs ReplaySafe

Stripe's idempotency keys prevent duplicate Stripe API calls. ReplaySafe prevents duplicate real-world consequences across your entire system - emails, webhooks, database writes, GitHub issues, and any custom API.

Side by Side

Aspect
Stripe Idempotency Keys
ReplaySafe
Scope
Stripe API only
Any side effect - HTTP, email, DB, webhooks, custom APIs
Lifetime
24 hours (default)
Forever - ledger persists indefinitely
State Machine
Not seen → Process → Seen (return cached)
Full lifecycle: INTENDED → EXECUTING → COMMITTED → VERIFIED
Verification
Returns cached response on retry (idempotent)
Provider-side verification - calls Stripe/SendGrid/GitHub to confirm what actually happened
Failure Classification
Per-error type (card_error, api_connection_error, etc.)
Unified TRANSIENT vs SEMANTIC across all providers
Resume / Recovery
None - you rebuild logic
guard.resume() - computes minimal safe continuation plan
Cross-Agent Coordination
Per-request only
Project-scoped shared ledger - Agent A's work visible to Agent B
Audit / Proof
Stripe's logs only
Cryptographic receipts stored in your DB, queryable anytime

The Core Difference

Stripe Idempotency

Prevents duplicate API callsto Stripe. If you send the same idempotency key twice within 24 hours, Stripe returns the cached response. But it doesn't know about your emails, webhooks, database writes, or other side effects.

ReplaySafe

Prevents duplicate real-world consequences across your entire system. Fingerprints every operation and tracks it through a full lifecycle. When something times out, it asks the provider what actually happened before retrying.

When to Use Which

Use Stripe Idempotency When

You only care about duplicate Stripe calls, you're okay with 24-hour key expiry, and you don't need cross-system coordination or verification.

Use ReplaySafe When

You have multiple side effects (payments + emails + DB writes), you need provider verification when outcomes are unknown, you want crash recovery with guard.resume(), or you're running multiple agents that need to coordinate.

You Can Use Both

ReplaySafe doesn't replace Stripe's idempotency keys — it layers on top. You can still pass idempotency keys to Stripe while ReplaySafe tracks the full lifecycle and coordinates across your entire system.

// ReplaySafe + Stripe idempotency — belt and suspenders
const result = await guard.effect({
  type: 'STRIPE_OPERATION',
  target: 'stripe-charge',
  input: { orderId, amount: 2999 },
  provider: 'stripe',
  execute: () => stripe.charges.create(
    { amount: 2999, currency: 'usd' },
    { idempotencyKey: `order_${orderId}` }  // Stripe's built-in dedup
  ),
  receipt: (r) => ({ chargeId: r.id }),
})

Next Steps

Ready to add execution memory to your agents? Start with the ReplayGuard SDK.