cd /news/ai-agents/5-things-your-ai-agent-needs-before-… Β· home β€Ί topics β€Ί ai-agents β€Ί article
[ARTICLE Β· art-178647] src=dev.to β†— pub= topic=ai-agents verified=true sentiment=↓ negative

5 Things Your AI Agent Needs Before You Give It a Wallet

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.

recommendation

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.

more in playbook: Securing agents and AI tools
by read5 min views4 publishedNov 30, 2026

Your AI Agent Can Lose Money 5 Ways. We Sealed All of Them.

In 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)

That made headlines. The boring failures don't.

We 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.

This 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.

Your agent requests a resource. The server answers HTTP 402: pay this much. Does your client compare that number to anything?

The 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])

To 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.

A spending cap is a ceiling. It is not a price.

Today you can enforce an expectation with the onBeforePaymentCreation hook (illustrative β€” check your SDK version's signature):

js
client.onBeforePaymentCreation(async (ctx) => {
  const req = ctx.selectedRequirements;
  if (req.amount !== EXPECTED_PRICE_ATOMIC) {
    throw new Error(`quote mismatch: ${EXPECTED_PRICE_ATOMIC} -> ${req.amount}`);
  }
  // bind recipient + asset + network too, not just the number
});

A first-class expectedAmount control is (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.

Two 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)]

Price controls don't catch this β€” both amounts are "correct". This needs its own primitive: a caller-supplied purchase ID, atomically reserved before signing.

purchase_id = random()                      # before fan-out
reserve(account, purchase_id, intent_hash)  # atomic, shared
  β†’ first reservation: ALLOW, sign
  β†’ same id + same intent: replay result, never sign again
  β†’ same id + different intent: conflict, reject

The 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.

Receipt: 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.

A cap that reads the window, evaluates, then writes is a suggestion, not a limit.

We 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.

The 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].

Lesson: 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.

200 means "the handler ran". It does not mean "the money moved".

We'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.

Your 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.

The 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.

The recovery rule is one line: on ambiguity, query before you retry.

on timeout / lost response:
  status = query_settlement(intent_id)
  if settled:   record evidence, deliver, done
  if not found: retry with the SAME intent id
  if unknown:   escalate to reconciliation β€” never blind-retry

If your payment stack can't answer "did intent X settle?" β€” that's not a missing feature. That's the finding.

The checklist (copy it into your README)

[ ] expected price checked pre-signature (cap β‰  price)
[ ] one purchase = one signature (atomic purchase-id reservation)
[ ] race-safe budget + kill switch
[ ] settlement evidence stored; UNKNOWN is a first-class state
[ ] query-before-retry recovery

Test it before your users do

Every failure above is reproducible from public, version-pinned fixtures. You don't have to trust us:

git clone https://github.com/igor-vii/Argus-Agent-Test-Lab
cd Argus-Agent-Test-Lab && node tools/registry/verify-registry.mjs

Building 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].

The 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]

Building an agent that pays? Tell me your stack in the comments β€” I'll tell you which of the five is hardest for it.

── more in #ai-agents 4 stories Β· sorted by recency
── more on @argus 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/5-things-your-ai-age…] indexed:0 read:5min 2026-11-30 Β· β€”