# SUBMISSION — Agents Open for Business (Loops House)

**Project:** AgentSpend Rail
**Track:** Agent Vault: Online & Onchain Checkouts (Self)
**Operator / named user:** elsanani
**Repo:** https://github.com/Rujekk/agentspend-rail
**Demo video:** `demo/demo-video.mp4` (in this repo; recorded from the real Agent Vault run of 2026-11-30 — narration script in `demo/narration-script.txt`)
**Prize payout wallet:** `0x9be63B7D664261A4D8c8aDa8442d76794be5659e`
**Submissions close:** 7 Dec 2026, 09:00 GMT

## Executive summary

AgentSpend Rail is an agent that does a real job for a named user (elsanani) the way agents will actually have to work: it **signs in to a regular website** and it **pays for what it uses** — without ever holding a secret. Through **Agent Vault (Self)**, the vault generates and keeps the website password; the agent works only with mock tokens that the vault's proxy substitutes in the page. The vault-minted Dailymotion login was created and approved by the operator (see the status note for one Agent Vault-side blocker on the final in-browser form step). For the paid leg, the agent buys two per-request data calls over **x402** on Celo mainnet via Agent Vault's `payRequest`, paid from the **Agent Vault agent wallet** — a wallet the agent cannot sign from and cannot withdraw from. A hard budget is enforced in the agent's own code (max 2 calls × 0.005 USDC; wallet funded with exactly 0.011 USDC), and a third, unaffordable call is attempted on purpose to show the budget biting. The deliverable is a research brief with a complete evidence trail. The agent is registered on **ERC-8004 (agent #10186)** and every transaction we originate carries our **ERC-8021 attribution** codes.

## Business case

Agents are useless if they can't have accounts. Every real workflow — ordering, booking, researching behind a login — needs a credential, and today the industry's answer is to hand the agent the raw password (and often the card). That is a breach waiting for a prompt injection. Agent Vault's pattern is the fix: the vault mints and holds the credential, the agent works with mock tokens inside a proxied browser, the holder approves new logins and new sellers, and every session is recorded on an Activity page the agent cannot edit. AgentSpend Rail wires that pattern to an onchain budget: the same agent that signs in *blind* also pays *bounded* — per-request x402 micropayments from a wallet it doesn't hold the key to, capped in code, funded to the cent. It is a reusable template for any agent service that must act on the real web: research assistants, purchasing agents, monitoring agents — anywhere "give the bot your password and your card" is the current, unacceptable status quo.

## What was built

- **Agent Vault integration** (`agents/av_*.ts`, official `@agentvault/playwright` SDK): token-catalog inspection (secrets never cross to the agent), wallet funding, agent-signup flow, `payRequest` job runner, status.
- **Sign-in leg:** vault-minted login for dailymotion.com (signup request `n579a4mb9xnqrqh2ya89j09fyh8k78p9`, approved by the operator in the dashboard; the login is saved in the vault and the agent only ever held mock tokens). The registry-verified recipe for the site's own form is email + password + date-of-birth selects, no email code, no CAPTCHA; submitting that form inside the vault proxy browser is currently blocked by an Agent Vault proxy egress outage (see status note) and is re-run by `npm run av:signup` as soon as egress recovers.
- **Paid leg:** two x402 calls to the usebuy.ai gateway (X post search, 0.005 USDC each, POST `https://gateway.usebuy.ai/v1/social/x/posts/search`, seller payTo `0x20faAca5F980E29639A0FCC6dcA6988E18ed333B`), paid from the Agent Vault wallet; deterministic idempotency keys make re-runs safe; a third call demonstrates the budget refusing.
- **The deliverable:** `brief.md` + `evidence-payments.json` per run under `agents/job-runs/<ts>-av/`.
- **Identity & attribution:** ERC-8004 agent #10186; ERC-8021 codes `agentspend_rail` + `celo_51ff2ced5a72` on every self-originated tx (including the AV-wallet funding transfer). x402 settlements are facilitator-submitted and cannot carry the suffix — the event FAQ says the same; their tx hashes are recorded instead.
- **Zero new money:** Agent Vault **Free plan** (5 card payments / 30 days, 1 agent card, unlimited logins — no card, no KYC); the x402 budget is our existing faucet-derived USDC.

## Status note (read first)

**The run happened on 2026-11-30.** The operator created the Agent Vault account (Free plan), set up the vault wallet, and issued the API key; the agent then funded the wallet (row 7), obtained the vault-minted Dailymotion login with the operator's one-click approval (row 8), and executed the paid job end-to-end: two settled x402 payments (rows 10–11), the budget-bite refusal (row 12), and the research brief (row 13). The operator approved the first payment to the seller ("tikhub (via Buy)") once in the dashboard; the seller is allowlisted in the vault from then on, so the second payment settled with no further approval.

**One honest blocker:** the final in-browser step of the sign-in leg — submitting Dailymotion's own signup form inside the vault proxy browser and the fresh sign-in proof (row 9) — could not complete during the run window because **Agent Vault's browser proxy egress was down**: the SDK tunnel connects, but every navigation fails with `ERR_SOCKS_CONNECTION_FAILED`. This was verified destination-independent (dailymotion.com, google.com, and example.com all fail identically through the SDK browser) across four attempts on 2026-11-30. The vault login itself exists and is approved; `npm run av:signup` completes the form step as soon as Agent Vault's egress recovers, and this table will be updated with its evidence file when it does. Everything else in this submission is live and verifiable today.

This entry previously targeted the Altana track; that path was abandoned on 2026-11-30 after a live read showed its KeyStore key-registration fee (≈ 19 CELO per grant) exceeds total hackathon faucet funding (0.50 CELO) ~19×, and the event rule we work under is $0 new money. The Altana scripts remain in the repo, marked DEPRECATED, as the audit trail of that decision.

## Evidence — transaction table (Celo mainnet, chainId 42220)

| # | What it proves | Reference |
|---|---|---|
| 1 | CELO faucet claim → admin EOA (0.25 CELO, code PM2M4C) | `0x22fdd6ddc22e659808fa2b328ba9c9522fa097d52211eaf4cfa09bf5a3b0e807` |
| 2 | CELO faucet claim → session EOA (0.25 CELO) | `0x35a2a4ba069cb3b34fa08db4ed32d2cad1bd9c9fdcb3f5357ee88073bfb0d6f0` |
| 3 | Tagged approve for the swap (ERC-8021 suffix) | `0x5003447340d9a055f5253e01710f9d9e37a9efe9a4f4ed0564bb5fc5067c9d4a` |
| 4 | Swap 0.20 CELO → 0.011625 USDC (the job budget) | `0x7007014ba801a728e7888418fb751a513477ca393cda5145b8ec8a5a136a6e9d` |
| 5 | Session EOA tops admin up with 0.20 CELO (tagged) | `0x4f92b5be18c7f9c353ea224c5a5dff2c7c4119c8642f8a76f96b80dd4e24eba6` |
| 6 | **ERC-8004 registration — agent #10186** (tagged, gas only) | `0x938521cbb4d9f07d96af1e41154350a9375739e7a567ba17db6dbf26c2fee1ff` |
| 7 | Fund Agent Vault wallet with 0.011 USDC (tagged) | ✅ `0x1ad224580fb157e176d4af3513ebbdbb290f1ca039b19643dff8bb93da051dcc` |
| 8 | Agent Vault signup: vault-minted login created + operator approval | ✅ request `n579a4mb9xnqrqh2ya89j09fyh8k78p9` approved in the dashboard; login "dailymotion" saved in the vault (agent held mock tokens only); vault Activity page + `npm run av:status` (logins: dailymotion) |
| 9 | Site form submission + fresh sign-in verified with the vault-minted login | ⚠️ blocked by an Agent Vault proxy egress outage (`ERR_SOCKS_CONNECTION_FAILED` on all destinations, 4 attempts, 2026-11-30) — `npm run av:signup` re-runs the step when egress recovers |
| 10 | x402 payment 1 ("Celo agent hackathon", 0.005 USDC, from AV wallet) | ✅ `0x5fc6b8aa1901471e75d281ad5d96510733a26265e246a862bbde1cae6b45e646` (paymentId `pay:jn74cmx4antvtg89e6r78kgnzn8k6tjt:asr-20261130-q1-r2`; operator approved the seller once) |
| 11 | x402 payment 2 ("x402 agent payments", 0.005 USDC) | ✅ `0x09de0844fe717c617a6f32efe941be30490dd80ec61245d50808ce6ec5c12c75` (paymentId `pay:jn74cmx4antvtg89e6r78kgnzn8k6tjt:asr-20261130-q2-r2`; no second approval — seller allowlisted) |
| 12 | Budget-bite demo: third call refused (~0.001 USDC left) | ✅ refused with code `insufficient_balance` — "The wallet holds less than the price in USDC… nothing was paid" — recorded in `evidence-payments.json` |
| 13 | Job deliverable: research brief for elsanani | ✅ `agents/job-runs/2026-11-30T13-46-39-941Z-av/brief.md` (12 posts from the 2 paid calls; raw responses `call1.json` / `call2.json` alongside) |
| 14 | Post-enrollment attribution fix: 0 CELO self-transfer from the agent wallet carrying all three ERC-8021 codes incl. the Loops-assigned `celo_2033b0b19346` (rows 1–12 predate enrollment and carry `agentspend_rail` + `celo_51ff2ced5a72` only) | ✅ `0x44722f4a7c4e1cb17d1040b2b9a23be6660353869ac2e05ad3730f58d7499704` (block 84148536; on-chain input verified to end with the three-code suffix) |

## Operator steps

### A. Agent Vault dashboard (~10 minutes, one time) — https://app.agentvault.io — ✅ DONE 2026-11-30

1. **Sign in with email.** The account is created on first sign-in. **Stay on the Free plan** — if a Plus trial is offered, decline it (it asks for a card; nothing in this project needs Plus, and no card is ever added).
2. **Vault → Wallet → Set up wallet** and accept the terms. Then **Vault → Wallet → Receive**: copy the wallet's **0x address** (Celo mainnet) — the agent needs it to send the 0.011 USDC funding transfer.
3. **Vault → API keys → New key**, with exactly: Cards = **All cards**; Logins = **All logins**; **Signing up = ON** ("Let this key create and change its own logins"); **Verification = test card OFF** (a test-card key can never pay from the wallet). The key (`av_…`) is shown **once**: save it into the keys dir as `agentvault.env` (one line, `SELF_AGENT_PAY_API_KEY=av_…`) — never into the repo, never into chat.
4. Add two more lines to the same `agentvault.env`: `SIGNUP_EMAIL=<email for the new Dailymotion account>` and `SIGNUP_DOB=<YYYY-MM-DD>` (your real date of birth — the signup form requires an adult DOB; the agent is forbidden to invent one).
5. **Be reachable while the job runs** for two one-click approvals (each has a ~15-minute window): the **Dailymotion signup request** (Vault → Logins) and the **first payment to the Buy seller** (dashboard prompt / Approvals). Optionally pre-approve `dailymotion.com` under Logins to skip the first.
6. Hand back to the agent: the wallet **Receive address** from step 2 (the key file stays on disk; it is never sent anywhere).

The agent then ran `av:fund` → `av:signup` → `av:job` on 2026-11-30; rows 7–13 above hold the results, and the demo video in `demo/` is narrated from that run's real evidence.

### B. Loops House project registration (operator, on loops.house)

Account sign-in on the event site is the operator's step. Values to enter:

| Field | Value |
|---|---|
| Project name | AgentSpend Rail |
| Track | **Agent Vault: Online & Onchain Checkouts (Self)** |
| Repo URL | https://github.com/Rujekk/agentspend-rail |
| Demo video | https://github.com/Rujekk/agentspend-rail/blob/main/demo/demo-video.mp4 |
| Payout wallet | `0x9be63B7D664261A4D8c8aDa8442d76794be5659e` |
| ERC-8004 agent ID | `10186` (registry `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`, Celo mainnet) |
| Attribution codes | `agentspend_rail`, `celo_51ff2ced5a72` |
| Named user | elsanani |

### C. Flagged rule — operator's own step (not actioned by the agent)

The event rules include **"Follow @Celo and @CeloDevs on X."** The agent does not touch the operator's X account under any circumstances; if this rule is enforced, it is the operator's own one-minute step.

## Addresses

| Thing | Value |
|---|---|
| Admin EOA (faucet-funded burner) | `0xb521772A5F2E3f918174Ff1152c744243b84611d` |
| Session EOA (burner) | `0x3b5E7fD558f85c6A0388c6BfaCE1d102e9835098` |
| ERC-8004 registry / agent id | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` / **10186** |
| Attribution codes | `agentspend_rail`, `celo_51ff2ced5a72` |
| Balances after the run (verified 2026-11-30 via `npm run av:status`) | admin 0.14857747 CELO + 0.000625 USDC; session 0.045340475 CELO; Agent Vault wallet 0.001 USDC (0.011 funded − 2 × 0.005 paid) |
| Agent Vault wallet | `0xdbb240c0e43d7c343593a7052843ce2808f7ea34` (handle `av_wallet_95evf`, userId `95evf`, network celo) |

## Post-review improvements (2026-12-05)

Appended after the AskBots round-2 review; no submitted fact above is changed.

- **Automated tests added:** `npm test` runs a 26-test offline suite (`tests/`) covering the payment flow (x402 request construction, settlement verification, budget-bite refusal, duplicate-payment guard) and the agent flow (ERC-8021 attribution, ERC-8004 registration encoding/parsing, Agent Vault env gate) with all network, wallet and Agent Vault calls stubbed.
- **Dependencies upgraded:** viem 2.58.8 → 2.58.10, which moves its pinned `ws` from 8.21.0 to 8.23.1 and clears the high-severity `ws` advisory (GHSA-37g9-w4hg-h9qr) behind the review's dependency findings; the dependency set now reports zero advisories.
- **CI:** a GitHub Actions workflow runs `npm ci` + `npm run build` + `npm test` on every push and pull request.
