Loops HouseCounterparty Guard + AgentVault

NEAR HACKATHON
Links
Team
1 member- KAOwner
Kai Douglas
Overview
Problem: AI agents now pay for APIs, data and compute, but one prompt injection in an invoice can make an agent send its owner's money to a scammer. Blocklists and allowances miss quieter losses: look-alike addresses, cap splitting, a trusted vendor overcharging, a vendor that never delivers.
What we built: (1) AgentVault, a Rust contract on NEAR (testnet: agvault2-vault-1114.testnet). The agent holds only a function-call key (spend, request_spend). The chain enforces per-tx, rolling-24h and per-receiver caps, an allowlist or a short-lived guard attestation bound to ONE payment_id, replay protection, typed on-chain rejections, and a circuit breaker that pauses the vault after repeated refused attempts. (2) Counterparty Guard (Python, FastAPI + CLI): allow/warn/block with reasons for every payment: look-alike and poisoned addresses, young accounts, changed code, cap splitting, normalised prompt-injection screening and vendor overcharging versus quote and history. An allow becomes an on-chain attestation, so the guard cannot be skipped. (3) Escrow: for a first payment the vault locks the money; the independent guard releases it after delivery or refunds it. The agent cannot release its own escrow.
Evidence: 52 Rust unit tests (one replays 709 operations of the benchmark's Python twin against the real contract), 7 sandbox tests, 57 Python tests, a 31-step run on NEAR testnet, and an open benchmark of 29 attacks and 27 legit payments. On the original 20 attacks, loss fell from 350 USD (v1) to 108 by default, 8 with per-vendor caps and 0 with strict mode and escrow; the false-block rate is reported next to it, and docs/ZERO_LOSS.md gives root cause, cheapest fix and cost of every residual.
How NEAR fits: function-call keys make least-privilege agent spending native, account-level contracts hold budget and escrow, and cheap transactions make per-payment approvals practical.