Skip to content
DeFi & BlockchainPaymentsSecurity

Agent Wallet Security: Spending Limits and Delegated Permissions

Agent wallet security explained for founders: the threat model, layered controls, spending limits, delegated permissions, and how to hire a team to build it.

Anointed Coder Jul 27, 2026 9 min read

Giving an AI agent a wallet feels like handing your car keys to something that occasionally hallucinates a left turn into a lake. The instinct to hesitate is correct. An agent that can spend funds is a new and attractive attack surface, and the failure modes are not theoretical. But the reason it is now reasonable to let an agent hold or move money is not that the models got trustworthy. It is that the security design around them matured to the point where the model's judgment stops being the thing that protects your treasury.

On 29 July 2026, MoonPay shipped PayBox, a non-custodial vault that lets an AI assistant execute crypto transactions using MPC key management and passkey approval. It is worth studying because it demonstrates the core principle in production: the agent proposes, and a separate, deterministic layer decides. This post lays out the threat model plainly, then the controls that contain it, layer by layer. It is written for founders and CTOs deciding whether to build an agent wallet, and who to trust with it.

The threat model, stated plainly

Before any control makes sense, name what you are defending against. Agent wallet security has four core threats, and every good design maps back to them.

  • A compromised or hallucinating agent. The model decides, incorrectly, to send funds somewhere it should not. No malice, just a wrong output that happens to move money.
  • A prompt-injection attack. Hostile text arrives inside the agent's context, from a scraped web page, an email, a tool result, or a document, and instructs the agent to drain the wallet or change a recipient. The agent, being helpful, complies.
  • A leaked or stolen key. The signing key is exposed through a bug, a bad dependency, a compromised server, or an insider. Whoever holds it can sign anything.
  • A malicious or buggy destination. The agent interacts with a contract designed to steal, or one that behaves unexpectedly and drains more than intended.

The mistake most teams make is trying to fix all four with a smarter prompt. You cannot prompt your way out of a security problem. The fix is architectural.

The controls, layer by layer

Defense in depth means no single failure loses the funds. Each layer assumes the one above it failed.

Non-custodial key management (MPC and TSS). Start where theft starts: the key. Multi-party computation and threshold signature schemes split the signing key into shares held by different parties, so no single machine ever holds a complete key. There is no single file to steal and no seed phrase in an environment variable, and a threshold of shares must cooperate to sign. This removes the single point of theft that makes a leaked key catastrophic.

Smart-contract wallets with account abstraction. Instead of a plain externally owned account, the wallet is a smart contract that enforces its own rules on-chain. Account abstraction lets you encode spending logic, approval requirements, and recovery into the account itself, where an attacker cannot bypass it with a merely valid signature. The rules live at the contract level, tamper resistant and independent of your backend.

Session keys with tight scopes. Rather than give the agent broad authority, issue a session key: a temporary, narrowly scoped credential that can only do specific things, for a specific window, up to a specific amount. A session key might allow swaps on one protocol, under a cap, expiring in an hour. If it leaks, the blast radius is bounded by its scope, not your whole balance.

Per-transaction and per-period spending limits. Cap the size of any single transaction, and cap the total over a rolling window: per hour, per day, per week. A hallucination or a hijack can then move only a bounded amount before it hits a wall. Limits are enforced by deterministic code, never by the model, because they must be predictable.

Allowlists and denylists. Constrain where funds can go. An allowlist of approved destination addresses and contracts means the agent can only transact with pre-vetted counterparties, while a denylist blocks known-bad addresses. For many products, an allowlist alone eliminates the entire "drained to an attacker's wallet" class of failure, because the attacker's address was never on the list.

Transaction simulation before signing. Before anything is signed, build the transaction and simulate it against current chain state. Simulation reveals the actual effect: the real recipient, token, amount, and balance change. It catches a wrong recipient, an unexpected token approval, a bad slippage figure, or a contract that would pull more than intended. This is the single most underrated defense against both hallucinated and injected transactions, because it checks reality, not intent.

Human-in-the-loop approval for high-value actions. Above a threshold, or for anything unusual, pause and require a human to confirm with a passkey (Face ID, Touch ID, or a hardware key). The agent handles the routine, in-policy flow autonomously; a person authorizes the consequential moves. PayBox uses exactly this passkey-gated pattern.

Rate limits and a circuit breaker. Cap the frequency of actions, and add a kill switch. If activity spikes abnormally, if the loss over a window crosses a threshold, or if something looks wrong, the circuit breaker halts all signing instantly and one command freezes the wallet while you investigate. Every serious system needs an off switch a human can reach fast.

Multisig for treasury. Operational funds and treasury funds should not live together. Keep the bulk of the value in a multisig that requires multiple independent human signers to move, entirely outside the agent's reach. The agent works from a small, refillable operating balance, so even a total compromise cannot touch the treasury.

Full audit logging. Record every intent, policy decision, simulation result, signature, and settlement. When something goes wrong, and eventually it will, you need a complete, tamper-evident trail to understand what happened and to prove what did not. Logging is also how you detect slow, low-value abuse that stays under your limits.

Prompt injection is a policy problem, not a model problem

The defense against prompt injection deserves its own statement, because it is the threat founders worry about most. You do not defend against it by asking the model to ignore malicious instructions. You defend against it by making the model's output non-authoritative. The agent's proposal is just a request, and a deterministic policy engine, plain code with no language model in it, decides whether that request is allowed against your limits, allowlists, and thresholds. If injected text tells the agent to send everything to a new address, the agent may well try. The policy engine sees an unlisted destination over the cap and refuses. The intelligence proposes. The guardrails dispose.

Controls mapped to the risk each mitigates

ControlPrimary risk it mitigates
MPC and TSS key managementLeaked or stolen key; single point of theft
Smart-contract wallet with account abstractionOn-chain rule bypass; unenforced limits
Session keys with tight scopesOver-broad delegation; leaked-credential blast radius
Per-transaction and per-period limitsCompromised or hallucinating agent draining funds
Allowlists and denylistsFunds sent to an attacker or malicious contract
Transaction simulation before signingWrong recipient, token, or amount; malicious destination
Human-in-the-loop passkey approvalHigh-value mistakes and hijacked large transfers
Rate limits and circuit breakerRapid automated draining; runaway agent loops
Multisig treasury separationTotal agent compromise reaching core funds
Full audit loggingUndetected abuse; no forensic or compliance trail

Defense in depth: a build checklist

  1. Split the signing key with MPC or TSS so no machine holds a whole key.
  2. Deploy the wallet as a smart-contract account that enforces rules on-chain.
  3. Issue scoped, time-boxed session keys instead of broad authority.
  4. Set per-transaction and per-period spending caps in deterministic code.
  5. Restrict destinations and contracts with an allowlist, and block a denylist.
  6. Simulate every transaction and verify its real effect before signing.
  7. Route high-value or unusual actions to human passkey approval.
  8. Enforce rate limits and wire a one-command circuit breaker.
  9. Keep treasury in a separate multisig, outside the agent's reach.
  10. Log every intent, decision, and signature to an audit trail.

How we build this at Anointed Coder

Anointed Coder builds secure agent wallets and, just as importantly, the policy layer around them. Our blockchain development team handles the on-chain side: smart-contract wallets, account abstraction, session keys, and MPC signing. Our DeFi development work covers the transaction building, simulation, allowlists, and settlement logic that keep an agent inside its scope while it interacts with live protocols. The deterministic policy engine that neutralizes prompt injection is code we write and own with you, never a prompt we hope holds.

We work in milestones, so you fund the next phase only after reviewing the last one. You get a weekly staging deployment to test against, and you own the complete source code with no lock-in. A hardened agent wallet with a real policy layer, simulation, and human approval typically runs from a few weeks to a couple of months and lands in the low-to-mid five figures, depending on the chains, the custody model, and how much treasury and compliance tooling you need. We scope it honestly before you commit.

If you are weighing whether an agent should hold funds at all, these three reads go deeper: how to build an AI crypto wallet, the anatomy of AI agent payment systems, and building web3 agents that transact. For the agent reasoning itself, our AI and LLM development team builds the model side to feed clean, structured intents into the policy engine.

To scope a build, contact us or reach out on WhatsApp, and we will map your threat model to the controls above before writing a line of code.

Recap: an agent wallet is safe not because the model is trustworthy, but because the model's output is never authoritative. Non-custodial keys remove the single point of theft. Spending limits, allowlists, and delegated session keys bound what any single failure can cost, simulation and passkey approval catch mistakes before they settle, and a deterministic policy engine, not a prompt, is what stops prompt injection. Build all of it, and letting an agent spend money stops being a gamble and becomes an engineered, auditable system.

Frequently asked questions

How do you secure an AI agent's wallet?

With defense in depth: non-custodial key management, spending limits, destination allowlists, transaction simulation, passkey approval for high value actions, rate limits, and full audit logging. No single control is trusted on its own.

What are spending limits and delegated permissions?

They are rules that scope what an agent can do: how much it may spend per transaction and per period, which addresses and contracts it may touch, and for how long. Delegation grants a narrow, revocable permission rather than full control of the wallet.

Can prompt injection drain an agent wallet?

It is a real threat, which is why the model must never be the final authority on a payment. A deterministic policy engine decides what is allowed, so even a manipulated agent cannot exceed its limits or send to an unapproved destination.

Do you need a security audit for an agent wallet?

For anything holding real funds, yes. Smart contract wallets and the policy layer should be reviewed before launch, and we build with that review in mind rather than bolting it on at the end.

Thinking about building something like this?

We'll scope it, plan it, and give you a clear timeline and quote, no obligation.

Keep reading