Verity Documentation
Verity guarantees that external side effects — payments, refunds, infrastructure provisioning, emails — execute exactly once, even when your workflow engine or retry logic re-runs your code. Works with Temporal, Trigger.dev, Inngest, or standalone.
Why Verity?
Temporal, Trigger.dev, and Inngest retry your activity when it fails. But if that activity already called Stripe before the crash, the retry calls Stripe again. The workflow engine has no way to know the external call already succeeded — so it re-executes it.
The Problem
Your Temporal activity calls Stripe, then the worker crashes:
// Temporal activity
async function processPayment() {
const charge = await stripe.charges.create({ ... }); // ✓ Succeeds
// [CRASH HERE]
return charge; // Never reached
}What happens:
- Stripe charge succeeds
- Worker crashes before returning
- Temporal doesn't know it succeeded
- Temporal retries the activity
- Stripe gets called again → double charge
With Verity
async function processPayment() {
return await verity.protect('charge-order-123', {
observe: () => stripe.charges.list({ metadata: { orderId } }),
act: () => stripe.charges.create({ amount: 5000 }),
});
}What happens:
- Stripe charge succeeds
- Worker crashes
- Temporal retries the activity
- Verity checks Stripe first (
observe) - Finds existing charge → returns it without calling Stripe again
Not Using a Workflow Engine?
Verity works just as well standalone. Any time your code performs a real-world action that can't be undone — payments, emails, infrastructure provisioning — wrap it in verity.protect() and get exactly-once guarantees, crash recovery, and a complete audit trail.
- Double charges — an agent retries a payment after a timeout, charging the customer twice
- Ghost infrastructure — a VM gets provisioned but the commit crashes, leaving zombie resources
- Duplicate notifications — five identical emails sent because the worker restarted mid-batch
- Zero audit trail — when something goes wrong, there's no way to know what actually happened
Verity solves this with a simple protocol: Lease → Observe → Act → Commit. Every action is fenced, tracked, and safe to retry — even across crashes, concurrent agents, and network failures.
How It Works
Verity wraps your side effects in a protection protocol:
- Lease — acquire exclusive ownership of an action using a unique key
- Observe — if a prior attempt crashed, check the external system to see if the action already completed
- Act — execute the real-world action (charge, email, provision, etc.)
- Commit — record the result in Verity's ledger, making the action permanent and idempotent
All of this is handled by a single SDK call: verity.protect(). You provide the action and (optionally) an observe function. Verity handles leasing, fencing, retry coordination, and audit logging.
SDKs
Verity provides official SDKs for TypeScript and Python with identical behavior:
Key Features
| Feature | Description |
|---|---|
| Exactly-once execution | Fence tokens prevent duplicate actions, even across retries and concurrent agents |
| Crash recovery | If an agent crashes mid-action, the next attempt checks what actually happened before acting |
| Audit trail | Every lease, observe, act, and commit is logged with timestamps, fence tokens, and agent IDs |
| Workflow orchestration | Group multiple effects into named workflows with case and run tracking |
| Explorer UI | Visual dashboard to observe effects, trace failures, and manage workflows in real-time |
| Cross-system safety | Works across any external system — Stripe, AWS, email providers, databases, and more |
Architecture
Your Agent / Worker
│
▼
┌──────────┐
│ Verity │ ← SDK (TypeScript / Python)
│ SDK │
└────┬─────┘
│ HTTPS
▼
┌──────────┐
│ Verity │ ← REST API (lease, commit, fail, renew)
│ API │
└────┬─────┘
│ SQL (RLS)
▼
┌──────────┐
│ Postgres │ ← Effect ledger + audit log
│ (RLS) │
└──────────┘Verity sits on the critical path — between your agent and the external world — and that's exactly where reliability belongs.
What's Next?
- Quickstart — protect your first action in 5 minutes
- Core Concepts — understand effects, leases, and fence tokens
- Workflows — orchestrate multi-effect business processes
- Error Handling — understand every error the SDK can throw
- Explorer UI — observe and manage your effects in real-time