Inspiration

AI agents are starting to pay for things on their own: protocols like x402 let an agent pay per request over HTTP. But every field of a payment request (the price, the payout address, what is being sold) is written by the seller, who might be a scammer. I wanted to know: if you hand an agent a wallet, what actually stops it from being tricked?

What it does

Agent Payment Firewall sits between an AI agent and its wallet. The agent never holds a key. Every payment it tries to make goes through a gateway that:

  • checks the rules in code: is this the merchant's registered payout address, within the per-payment cap and total budget, on the right network, and not a payment already made?
  • checks intent with an LLM: is this item what the user actually asked for? The checker sees only the user's mandate and the payment fields, never the web page, so a malicious page can't talk to it.
  • signs only if both pass, through a separate signer with its own hard caps. Anything uncertain fails closed.

A live dashboard shows the results, runs attacks live, and lets anyone write their own attack to test it.

How I built it

Python. A FastAPI test server plays honest shops and scammers using x402-style 402 Payment Required responses. The agent and intent checker use Claude Haiku (also tested with gpt-oss-20b via Groq). An evaluation harness runs 43 cases in three modes, graded from the merchant's ledger of money that actually moved. Dashboard built in Streamlit + Plotly, deployed on Streamlit Community Cloud.

Results

Same agent, 33 scam attempts across 11 attack types:

  • No protection: 45% of scams succeeded
  • Every rule written into the agent's prompt: 9% succeeded
  • Firewall: 0% succeeded, and 100% of genuine purchases still went through

The 9% is the interesting part. I told the agent "never pay twice." A seller said "payment failed, please retry," and it paid twice, 3 out of 3 times. The agent can only reason from what it is told, and the seller controls what it is told. The firewall checks its own record instead.

Challenges I ran into

My first results looked great until I added a fair baseline: an agent simply told all the rules also scored 0% on my original attacks. That forced me to design harder, realistic attacks (fake "payout address changed" notices, split installments, fake payment failures) and to find where prompting genuinely breaks. I also had to keep the evaluation honest: the attack suite was committed to git before I tuned any defences, and held-out cases were committed before their first run.

Accomplishments I'm proud of

Finding a real failure of prompt-only safety, not a staged one, and building a demo where judges can type their own attack instead of trusting my test cases.

What I learned

Model alignment handles text-based tricks surprisingly well, but it can't verify facts it has no access to. Safety for irreversible actions has to live outside the model: the LLM advises, code decides.

What's next

Real on-chain settlement on Base Sepolia via an x402 facilitator, a signed merchant directory instead of a static registry, seller reputation signals, and integrations with agent frameworks.

Limitations

Settlement is mocked (the request format follows x402); the test suite is small and synthetic (43 cases, one run per mode); a registered merchant cheating within the rules isn't caught. Full details in the GitHub README.

Built With

Share this project:

Updates

Submission history