What once does
Once provides an execution-safety boundary for agent operations that change external state. Its purpose is to prevent unsafe retries after ambiguous failures such as lost responses, timeouts, or process restarts. A logical operation is recorded once, and later attempts use that recorded state rather than blindly issuing another provider request.
Confirmed operations can be replayed without producing another external effect. If the original result cannot be established, Once returns an UNKNOWN state and blocks redispatch. That state is deliberately conservative: the action may already have succeeded, so the operation identity and durable ledger must be retained while an authoritative read-only lookup is performed.
The server is relevant to AI coding agents that can invoke tools for refunds, bookings, payments, messages, tickets, or other consequential writes. It does not automatically provide support for a particular payment or business provider; the host supplies the provider callback and, when available, the reconciliation function.
How it works
The host defines a stable operation identity and the complete effect description, including account, tenant, and other effect-bearing fields. Once uses those values to associate retries with the same logical intent. A host-owned async callback performs the actual provider operation, while an optional reconciliation function checks authoritative provider truth.
The normal flow distinguishes confirmed, unknown, and conflicting attempts. A confirmed result can be replayed after a restart. Changing effect data for an already recorded identity creates a conflict rather than another write. When reconciliation cannot confirm the original result, the retry remains blocked. Genuine new intents therefore need distinct operation IDs, such as separate IDs for legitimate partial refunds.
Protection depends on the ledger as part of execution authority. Replacing, deleting, resetting, rolling back, or switching the valid ledger can allow an effect to run again, and a matching filesystem path alone does not prove that the same history is present.
Setup and configuration
The MCP package can be started with:
The documented local integration uses Node.js 24.15 or newer and a persistent SQLite file shared by the protected process on one machine. No account or API key is required. With the SDK, wrapTool receives the callback plus operationId, effect, statePath, and an optional reconcile function. The reconciliation function should return a confirmed result only from authoritative provider data; otherwise it should report UNKNOWN.
Preserve the original consistent SQLite state across restarts and do not reinitialize expected state when it is missing. Every write that needs protection must pass through the wrapper. Internal retries hidden inside the callback remain outside this protection boundary.
Tools and capabilities
- Protect host-owned asynchronous tool callbacks with
wrapTool.
- Protect local functions with the SDK's
protectLocal path.
- Classify supported agent tools as BYPASS, PROTECT, or fail-closed UNKNOWN through the automatic Connect path.
- Wire local tool registries with logical identity and effect binding.
- Wrap OpenAI Agents function tools directly.
- Run read-only checks, a controlled proof, and diagnostic assessment through the SDK command-line interface.
The controlled proof uses a local HTTP provider and an effect journal to demonstrate lost acknowledgements, restart replay, conflict detection, and UNKNOWN blocking. Its evidence applies to that controlled fixture rather than to a real financial provider.
Limitations and notes
Once does not promise universal exactly-once execution and does not replace a database, queue, framework, Temporal, or a provider's native idempotency mechanism. Use a provider idempotency key or a database uniqueness constraint when either completely solves the operation, and retain those protections when using Once.
The local SQLite authority is limited to one machine and requires durable shared state. UNKNOWN blocking does not repair lost history, and observing that an effect is absent does not automatically authorize local redispatch. Opaque callback retries and connector-only model access are outside the protection boundary.
The LangGraph evidence covers deterministic local JavaScript checkpoint replay with a persistent same-machine SQLite authority. It is not evidence for LangGraph Cloud behavior, a Cloud sweeper, or a universal fix for Cloud execution.