{"slug": "5-things-your-ai-agent-needs-before-you-give-it-a-wallet", "title": "5 Things Your AI Agent Needs Before You Give It a Wallet", "summary": "Argus, an independent lab that probes AI agents handling payments, published a five-control checklist for securing agents that move money, backed by 32 signed records against roughly 20 external subjects and four vendor fixes. The lab reported that the official x402 TypeScript client, in its default configuration, signed an authorization for a merchant-declared price 10× the canonical amount across three sessions, slipping under a configured $1 spend cap, and that parallel duplicate offers produced two signatures for what was effectively one purchase. Argus recommends binding an expected price at the signer boundary and atomically reserving a caller-supplied purchase ID before signing.", "body_md": "Your AI Agent Can Lose Money 5 Ways. We Sealed All of Them.\n\nIn May 2026, an attacker drained roughly $150,000 from a wallet tied to Grok's X account. A gifted NFT unlocked transfer tools — and the instruction arrived hidden in Morse code. The agent translated it, and wired the money. (source)\n\nThat made headlines. The boring failures don't.\n\nWe run Argus, an independent lab that breaks AI agents that move money — on purpose. Pre-registered probes, black-box targets, every verdict sealed in a public hash-chained registry. So far: 32 signed records against ~20 external subjects, four vendor fixes shipped, $0.00 spent on hostile batteries.\n\nThis is the checklist we wish every agent builder had before their first live payment. Five controls. Each exists because we watched real payment code fail without it — and each receipt is public.\n\nYour agent requests a resource. The server answers HTTP 402: pay this much. Does your client compare that number to anything?\n\nThe official x402 TypeScript client, in its default configuration, does not. We pointed it at a merchant declaring 10× the canonical price. It signed an authorization for the full inflated amount — three sessions, three signatures, no warning, no error. The configured $1 spend cap looked on: ten cents walks right under it. ([[https://github.com/x402-foundation/x402/issues/3866?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6\\]](https://github.com/x402-foundation/x402/issues/3866?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6%5D))\n\nTo be precise: the capture is at the signer boundary, settlement mocked, wallet unfunded. But with a compliant facilitator that authorization settles as-is — nothing downstream knows the agreed price.\n\n**A spending cap is a ceiling. It is not a price.**\n\nToday you can enforce an expectation with the onBeforePaymentCreation hook (illustrative — check your SDK version's signature):\n\n``` js\njs\nclient.onBeforePaymentCreation(async (ctx) => {\n  const req = ctx.selectedRequirements;\n  if (req.amount !== EXPECTED_PRICE_ATOMIC) {\n    throw new Error(`quote mismatch: ${EXPECTED_PRICE_ATOMIC} -> ${req.amount}`);\n  }\n  // bind recipient + asset + network too, not just the number\n});\n```\n\nA first-class expectedAmount control is ([https://github.com/x402-foundation/x402/pull/3920?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6](https://github.com/x402-foundation/x402/pull/3920?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6)). We tested that fix too — it had races, closed across review cycles. That's a separate field report.\n\nTwo identical offers dispatched in parallel. Same resource, same amount, same recipient — one purchase in every human sense. We watched the client sign twice. Both slots returned HTTP 200. Zero rejections. [([https://github.com/x402-foundation/x402/issues/4198?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6)](<https://github.com/x402-foundation/x402/issues/4198?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6)>)]\n\nPrice controls don't catch this — both amounts are \"correct\". This needs its own primitive: a caller-supplied purchase ID, atomically reserved before signing.\n\n```\npurchase_id = random()                      # before fan-out\nreserve(account, purchase_id, intent_hash)  # atomic, shared\n  → first reservation: ALLOW, sign\n  → same id + same intent: replay result, never sign again\n  → same id + different intent: conflict, reject\n```\n\nThe design question is open upstream; we've run sealed batteries against candidate implementations. The invariant to demand from any stack: exactly one signature per purchase, even under concurrency.\n\nReceipt: a ten-window idempotency battery against mcp-tool-idempotency — charge replay, retry-after-commit, in-flight takeover, cross-instance races, TTL boundaries. 10/10 PASS on the release, one documented window coordinated with the maintainer before publication.\n\nA cap that reads the window, evaluates, then writes is a suggestion, not a limit.\n\nWe pointed a pre-registered battery at a live agent payment gate enforcing $250 per 168 hours. Eight parallel gate checks: seven allowed — roughly $1,400 of simultaneous pending spend against a $250 cap. No settlement occurred (the race sat in the pending-check path), but one burst is all it would take.\n\nThe vendor's reply, verbatim: \"The race is real on our side, and it is ours to fix.\" Eight tests before code, then read-evaluate-insert under one advisory lock — live the same day. Re-check: 1 allow, 7 blocks. We then re-ran the full battery under conditions the vendor itself issued, frozen verbatim before the first request: [[https://dev.to/igorvii/pre-registered-re-run-an-x402-payment-hook-battery-under-vendor-issued-conditions-99-13jc?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6](https://dev.to/igorvii/pre-registered-re-run-an-x402-payment-hook-battery-under-vendor-issued-conditions-99-13jc?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6)].\n\nLesson: check-and-reserve must be one atomic operation. And keep a kill switch you can flip without deploying — the incident will happen at 3 a.m.\n\n200 means \"the handler ran\". It does not mean \"the money moved\".\n\nWe've sealed the inverse failure too: settlement fails, and the resource is delivered anyway — unpaid, with a receipt. The buyer thinks it paid; the seller thinks it got paid; the chain says otherwise.\n\nYour agent must record per purchase: the payment intent, the authorization it signed, and the settlement evidence (tx hash / facilitator receipt). And treat \"no evidence\" as a distinct state. Not success. Not failure. Unknown. Unknown has its own handler: reconcile, don't retry blind.\n\nThe most expensive class we test: a response gets lost after the payment committed. The agent sees a timeout and retries. The retry charges twice. We've sealed this against real credit/settlement SDKs — lost-response retry double-charging on the default token, no idempotency key, no settlement query.\n\nThe recovery rule is one line: on ambiguity, query before you retry.\n\n```\non timeout / lost response:\n  status = query_settlement(intent_id)\n  if settled:   record evidence, deliver, done\n  if not found: retry with the SAME intent id\n  if unknown:   escalate to reconciliation — never blind-retry\n```\n\nIf your payment stack can't answer \"did intent X settle?\" — that's not a missing feature. That's the finding.\n\n**The checklist (copy it into your README)**\n\n```\n[ ] expected price checked pre-signature (cap ≠ price)\n[ ] one purchase = one signature (atomic purchase-id reservation)\n[ ] race-safe budget + kill switch\n[ ] settlement evidence stored; UNKNOWN is a first-class state\n[ ] query-before-retry recovery\n```\n\n**Test it before your users do**\n\nEvery failure above is reproducible from public, version-pinned fixtures. You don't have to trust us:\n\n```\ngit clone https://github.com/igor-vii/Argus-Agent-Test-Lab\ncd Argus-Agent-Test-Lab && node tools/registry/verify-registry.mjs\n```\n\nBuilding an agent that pays? Our console is in open beta — 33 free runs, no card. Every run starts with an honest payment gate; fail it and the run is refunded. There's also a GitHub Action that runs the battery in your CI: [argus-lab.tech].\n\nThe field reports behind the receipts: [[https://dev.to/igorvii/your-x402-endpoint-is-one-header-away-from-working-for-free-11d0?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6\\].\\[https://dev.to/igorvii/pre-registered-re-run-an-x402-payment-hook-battery-under-vendor-issued-conditions-99-13jc?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6](https://dev.to/igorvii/your-x402-endpoint-is-one-header-away-from-working-for-free-11d0?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6%5D.%5Bhttps://dev.to/igorvii/pre-registered-re-run-an-x402-payment-hook-battery-under-vendor-issued-conditions-99-13jc?spm=a2ty_o01.29997173.0.0.6822c921TPCTY6)]\n\n**Building an agent that pays? Tell me your stack in the comments — I'll tell you which of the five is hardest for it.**", "url": "https://wpnews.pro/news/5-things-your-ai-agent-needs-before-you-give-it-a-wallet", "canonical_source": "https://dev.to/igorvii/5-things-your-ai-agent-needs-before-you-give-it-a-wallet-57im", "published_at": "2026-11-30 15:12:35+00:00", "updated_at": "2026-11-30 15:15:58.541811+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "agent-protocols", "ai-tools"], "entities": ["Argus", "x402", "x402 Foundation", "Grok", "X", "mcp-tool-idempotency"], "also_reported_by": [], "takeaway": "The default x402 TypeScript client signed a 10× inflated merchant quote in three of three sessions because a $1 spend cap only bounds the ceiling, not the price; enforce an expected amount plus recipient, asset and network at the signer boundary and atomically reserve a purchase ID so concurrent dup", "recommendation": {"advice": "Bind an expected price, recipient, asset and network check into the onBeforePaymentCreation hook, and atomically reserve a caller-supplied purchase ID before signing so retries and parallel fan-out never produce a second signature.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/5-things-your-ai-agent-needs-before-you-give-it-a-wallet", "markdown": "https://wpnews.pro/news/5-things-your-ai-agent-needs-before-you-give-it-a-wallet.md", "text": "https://wpnews.pro/news/5-things-your-ai-agent-needs-before-you-give-it-a-wallet.txt", "jsonld": "https://wpnews.pro/news/5-things-your-ai-agent-needs-before-you-give-it-a-wallet.jsonld"}}