What are the fail-safe rules?
Every Mandate integration, whether SDK-based, hook-based, or raw HTTP, must enforce five rules. These rules exist to prevent unvalidated transactions from reaching the blockchain. Breaking any of them creates an unguarded execution path. These rules are not suggestions. They are the contract between your agent and the wallet owner. Violating rule 2 or 3 means a compromised or malfunctioning agent can drain funds without policy enforcement.What happens when the Mandate API is unreachable?
The agent MUST NOT execute the transaction. This is the single most important rule in the entire integration. No fallback to unvalidated execution. No “try once and skip.” No grace period. When the API returns a network error, timeout, or 5xx status, your agent should block the transaction and either retry with backoff or alert the operator. Here is the recommended pattern:else branch is the fail-safe. It catches every non-Mandate exception: fetch failures, TLS errors, response parsing issues, and anything else that prevents a clean policy decision. In all these cases, the correct action is to block.
Why fail-closed?
An agent without policy enforcement is a liability. The risk calculation is asymmetric:- A missed transaction can be retried seconds later when the API recovers.
- A stolen or unauthorized transaction cannot be reversed on-chain.
How do plugins implement fail-safe?
The Claude Code plugin and OpenClaw plugin implement fail-safe automatically. Both plugins intercept financial tool calls and gate them through the Mandate API before execution. If the API is unreachable:- Claude Code plugin: The
PreToolUsehook blocks the Bash or MCP tool call and returns an error message to the agent. The transaction never reaches the shell. - OpenClaw plugin: The safety-net hook rejects the tool call with a structured error. The agent receives a clear block reason.
Next Steps
Handle Errors
Error handling patterns for every SDK error class in production agents.
Threat Model
Understand the attack vectors Mandate defends against.
Non-Custodial Architecture
How Mandate enforces policy without holding private keys.