Inspiration
AI agents can now pay for things on their own. That is useful, but nobody would hand an agent a card with no limit. We wanted to build the missing piece: an agent that has an allowance, the way a kid or an employee does. It can spend small amounts on its own, has to ask before anything bigger, can only pay sellers you trust, and can be frozen at any moment.
What it does
Allowance is a voice AI agent that answers questions about prediction markets and pays for the data it needs one request at a time, in USDC on Arc Testnet, through Circle Gateway nanopayments (x402).
You ask something like "What are the odds for Minnesota vs Oklahoma State?" and the agent:
- Uses free tools first (market search, the catalog, the budget, past purchases) and answers greetings and follow-ups without spending anything.
- Buys fresh data only when you actually ask for it, picking from a catalog of four paid items.
- Runs every purchase through a server-side spending policy before any USDC moves.
The demo shows four outcomes:
| Request | Price | What happens |
|---|---|---|
| Odds snapshot | 0.005 USDC | Paid automatically, then settles on Arc |
| Odds history and biggest movers | 0.02 USDC | Paid automatically |
| Deep brief across related markets | 0.75 USDC | Over the 0.25 limit, so it waits for a person to approve with the operator code |
| "Full report" from Shady Reports | 0.01 USDC | Blocked: that seller isn't on the allowlist, and nothing is charged |
The rules: a seller allowlist, auto-approve up to 0.25 USDC, at most 1.00 USDC per purchase and 2.00 USDC per day, and a freeze switch. The freeze also trips on its own if QuickNode Streams sees an outbound transfer from the agent's wallet that the policy didn't make.
How we built it
- Claude (
claude-sonnet-5-5, server-side) is the assistant. It has five free tools and exactly one paid tool,buy_market_data. The model can only choose the item and a ticker it has already seen; the server fills in the seller, URL and amount, so the model can't invent a payee or a price. - Spending policy and ledger (Node 22, TypeScript, SQLite): checks run in a fixed order: frozen → network and asset → seller allowlist → per-call cap → daily cap → funds → auto-approve limit. Allowed purchases reserve funds atomically with an idempotency key, so a resent message never charges twice. The ledger tracks
accepted(paid) separately fromsettled(onchain). - x402 on Arc via Circle Gateway: the seller answers HTTP 402 with a quote. A guarded signer signs the authorization only if payee, amount, asset, network and validity window all match the approved quote. Gateway batches the payments and a reconciler marks each purchase settled once the batch lands on Arc.
- Gemini Prediction Markets API: a recorder polls the active events endpoint every minute and stores prices on change. Snapshots, odds history and the deep brief are computed only from those recorded prices, and the brief says "insufficient history" rather than inventing movement.
- QuickNode Streams: an Arc Testnet stream on receipts/logs, filtered to native USDC
Transferlogs that touch the agent wallet, delivered to a webhook that verifies an HMAC signature, a 5-minute freshness window and a nonce replay guard. It records deposits and freezes spending on anything unexpected. - Frontend: Vite, React, TypeScript and Tailwind, deployed on Netlify; the backend runs on Railway. The browser never calls the purchase endpoint and never holds a secret, only short-lived session tokens in memory.
- Voice: the ElevenLabs Agents React SDK is integrated, with conversation tokens minted server-side. In the deployed build we fall back to browser speech recognition in Chrome and Edge.
72 backend tests cover the policy, the purchase flow, x402 term binding, the recorder, the webhook and the assistant's purchase gate.
Challenges we ran into
- Keeping the LLM away from money. The hard part wasn't making the agent buy things; it was making sure it doesn't buy on "wait", "stop", "never mind" or a greeting, never buys twice for one message, and can't approve its own purchases. Approval needs a separate operator code that the agent never sees.
- Signing safely. A Gateway authorization stays spendable for about seven days and can't be shortened, so we bind every signature to the exact payee, amount, asset, network and contract before the key is used, and refuse anything else.
- Paid vs settled. Gateway settles in batches, so a payment can be accepted minutes before it shows up onchain. We treat a timeout as pending rather than failed and keep the funds held until Circle confirms.
- No odds history in Gemini's API. We built our own recorder, which meant history only exists from the moment we started it.
Accomplishments that we're proud of
Real x402 nanopayments on Arc Testnet, end to end: a 0.005 USDC snapshot paid automatically and a 0.75 USDC deep brief approved by an operator, both settled onchain. Blocked and declined purchases show up in the ledger as "Not charged", with the reason.
What we learned
How x402 and Circle Gateway batch settlement actually work under the hood, what an EIP-712 authorization does and doesn't bind, and that guardrails for agent payments belong on the server, outside the model.
What's next for Allowance
- Turn on ElevenLabs voice in the deployed build
- Move confirmed top-ups into Gateway automatically
- Let anyone plug in their own x402 sellers; prediction markets are just the first catalog
- Per-seller and per-category budgets, plus spending reports