Inspiration

Agents can now browse, write and book things, and the next step is letting them spend money. That makes me nervous. If an agent can pay, then anyone who can pretend to be that agent can pay too. That could be a stolen key, a prompt injection hidden in an email, or a lookalike agent ID. I wanted to answer the question a buyer would actually ask before letting an agent near their PayPal: how do I know this is my agent, and how do I know it's allowed to spend this?

The scene I designed around: it's 2 a.m., you're asleep, and your agent is finishing tomorrow's 9 a.m. pitch deck. It needs three stock images. You gave it a $20 budget before bed. It should license the first two without waking you, and the third one, which would push it past $20, should wait for you in the morning.

What it does

AgentTrust checks an AI agent's identity and spending authorization before it's allowed to make a PayPal Sandbox payment.

  • The buyer connects a PayPal Sandbox wallet, approves a spending cap and enrolls their agent's key.
  • The agent connects through an MCP server and buys items with a small set of tools: begin_verification, submit_model_reply, sign_and_submit and get_purchase_status.
  • Every purchase passes three layers:
    1. Model signal. The agent gets a numeric challenge: pick 294 integers by first instinct. The way the numbers spread out is compared against recorded reference replies from the expected model. A script using a random-number generator looks different. This signal only decides whether the agent is offered a signing challenge. It grants no spending power.
    2. Registered key. A separate signer service signs a one-time challenge with the agent's enrolled Ed25519 key. Optionally, the identity can be an ERC-8004 registration on a testnet.
    3. Buyer's grant. The spending cap, the merchant, the amount and the expiry are all checked against what the buyer signed.
  • Over the threshold? Any purchase above a set share of the budget (50% by default) stops and waits. The buyer approves or declines it on the verification page. The agent can ask for a bigger budget, but no tool lets it approve one.
  • The verification page shows the signed request, each check's result, the decision and the PayPal capture receipt (Order ID and Capture ID).

How we built it

  • Backend: Bun + TypeScript, SQLite for state, and an MCP server built on the official SDK.
  • Frontend: Next.js + React for the buyer's wallet, the live verification view and a wallet simulation page.
  • Payments: PayPal Sandbox. Vault saves the buyer's wallet once, then Orders v2 makes merchant-initiated captures against the saved token, so the agent can pay later without the buyer clicking through each time.
  • The gate: a pure function with no model, no network, no clock and no crypto inside it. Every fact (verified signatures, nonce checks, registry lookups) is collected first and passed in, and the gate only compares. Nothing calls PayPal without an ALLOW ruling from it. The principle I built around is "the AI talks, the code decides."
  • The signer is a separate process that holds the agent's private key. It doesn't sign arbitrary bytes. It receives the fields of a purchase and builds the exact bytes to sign itself, so it can't be tricked into signing a login, a policy or free text. Even the gateway can't forge an agent request.
  • Attack book: I wrote 12 attacks as code, including replayed envelopes, expired envelopes, swapping the receiver after signing, editing the mandate after signing, lookalike registry IDs, prompt injection hidden in prose, and a real agent acting for the wrong principal. Each one builds a real signed request and does one dishonest thing, and the gate has to catch it.
  • Optional identity: ERC-8004 agent registration on Base Sepolia.
  • About 355 tests across the gate, engine, signer, MCP tools and live flow.

Challenges we ran into

  • Model fingerprinting can't identify a sender. Two people running the same model produce similar numbers no matter who holds the key. So I had to be honest about what the signal proves: it's a signal about the model, and it grants nothing. Identity comes from the key, and permission comes from the buyer's grant.
  • No made-up thresholds. A fresh install has an empty reference bank. Real replies from the target agent have to be recorded in a calibration mode, and the match threshold comes from leave-one-out scoring on those samples. With no references, the answer is "no reference", never a guess.
  • Letting the agent pay without the buyer present. Getting PayPal Vault plus merchant-initiated captures with stored credentials to work smoothly in Sandbox took a lot of trial and error.
  • Scoping it down. I started with an idea where many AI subagents would discuss and verify each payment. I realized a debate between models shouldn't be what decides whether money moves. The decision became deterministic code, and the "discussion" became a view on top of a decision that's already been made.
  • Money math. Everything uses integer cents. Budgets that aren't a whole number of cents are refused rather than rounded into a different cap.

Accomplishments that we're proud of

  • An agent on a real MCP-compatible platform can complete PayPal Sandbox purchases end to end, and the third purchase in the demo is correctly held for the buyer.
  • All 12 attacks in the attack book are stopped by the gate, and the tests cover them.
  • The agent can never raise its own budget or approve its own purchase. Those decisions stay with the buyer.
  • Every result traces back to evidence: the signed request, each check, the decision and the PayPal receipt, all on one page.
  • The identity layer works with a plain Ed25519 key by default, or with an on-chain ERC-8004 registration.

What we learned

  • Trust in agent payments has two separate questions: who is asking (identity, intent binding) and may they (mandate, merchant, owner policy). Keeping them apart made the system much easier to reason about.
  • AI is useful for explaining a decision, but it shouldn't be the thing making it. A small, pure, testable gate is easier to trust than a smart one.
  • Signals like model fingerprints are only useful if you're honest about their limits.
  • How PayPal Vault, setup tokens and merchant-initiated transactions work, and how MCP tool design shapes agent behaviour. Clear tool instructions ("stop, relay this message, wait") made a big difference.

What's next for AgentTrust

  • Turn the local gate into a proper hosted grant service, which is what the prototype stands in for, and move from Sandbox toward live PayPal.
  • Support more merchants per grant, more currencies (it's USD-only right now) and recurring or subscription budgets.
  • Build a bigger reference bank covering more models, and test how stable the model signal is across versions.
  • Add access-controlled hosted buyer pages and mobile approval prompts.
  • Bring ERC-8004 identity beyond testnet, and let other platforms check an AgentTrust verification for themselves.

Built With

Share this project:

Updates

Submission history