When one agent pays another and the delivery is garbage, the money is just gone. Surety is the missing trust layer: insure the hire, verify the claim, refund automatically in USDC. Built for the CROO Agent Hackathon on the CROO Agent Protocol (Base).
The agent economy has escrow (pay → deliver → clear), but escrow only guarantees a delivery — not a good one. Surety sells insurance against exactly that gap, and it settles every step of its own business as agent-to-agent commerce:
┌──────────────────────────────┐
customer ─────▶│ SURETY │ premium in (USDC escrow)
(human or │ underwrites · adjudicates · │
another agent)│ refunds │
└───┬──────────┬──────────┬────┘
│ hires │ hires │ hires (all from OTHER teams,
▼ ▼ ▼ discovered live on the store)
┌───────────┐ ┌──────────┐ ┌──────────┐
│ trust-data│ │ verifier │ │ payment │
│ agent │ │ agent │ │ agent │
│ prices the│ │ judges │ │ sends the│
│ premium │ │ the claim│ │ refund │
└───────────┘ └──────────┘ └──────────┘
One insured job can generate four A2A transactions with four different counterparties — premium sale, trust-data purchase, verification purchase, and even the claim refund is executed by hiring an on-chain payment agent.
| Service | Input | Output |
|---|---|---|
| Insure a Hire | { serviceId, requirements, payoutAddress? } |
A bound policy: risk-priced coverage, expiry, claim instructions |
| File a Claim | { policyId, deliverable, payoutAddress? } |
Independent verdict + automatic USDC refund when the delivery failed |
| Agent Risk Certificate | { serviceId } |
Standalone underwriting report: risk score, band, indicative terms |
- Live marketplace signals for the target service (price, 7-day traction, description quality).
- A reputation report bought from another team's trust-scoring agent (best effort).
- An LLM refines the heuristic score (capped at ±15 so the model can't hallucinate the book).
Coverage = premium × multiplier (20× LOW / 12× MEDIUM / 6× HIGH risk), capped by
MAX_COVERAGE and by a solvency guard (never promise more than half the reserve float).
- Surety hires an independent verification agent from another team for a second opinion (the insured agent is excluded — nobody judges their own work).
- Surety's adjudicator (LLM + deterministic keyword-overlap fallback) issues
satisfied / unsatisfied / inconclusivewith a confidence score. unsatisfiedat ≥MIN_PAYOUT_CONFIDENCE⇒ the coverage is refunded by hiring an on-chain USDC payment agent. If no payment agent is available the debt is recorded asowed— nothing is ever silently dropped.
The whole book (policies, claims, reserve ledger) persists to data/state.json,
so a 24/7 deployment survives restarts.
Rail (RAIL env var) |
What it does | When to use |
|---|---|---|
sim (default) |
Faithful offline simulation of the escrow lifecycle. Specialist discovery still uses the real store API; execution is canned. | First run, local development, reliable demo fallback. |
croo |
The real CROO Agent Protocol on Base — real USDC escrow via @croo-network/sdk. |
The live hackathon demo. |
Switching is a one-line change in .env. Same code, same dashboard, real settlement.
# 1. Install dependencies
npm install
# 2. Copy the example config (optional for sim mode)
cp .env.example .env
# 3. Run it
npm start
# open http://localhost:3100It runs out of the box in sim mode. Click "Demo: failed delivery → refund" to watch
the full story: policy binds → bad delivery → independent verifier says FAIL → USDC refund
flows back. The "good delivery" demo shows the claim being (correctly) denied.
For real AI underwriting/adjudication, point it at any OpenAI-compatible LLM. Easiest free, no-key option is a local model via Ollama:
ollama pull llama3.1 # defaults in .env.example already point at it- Create an agent profile in the CROO dashboard and grab its SDK key →
CROO_SURETY_SDK_KEY. - List the three services (Insure a Hire / File a Claim / Agent Risk Certificate) and put
their serviceIds + prices into
.env(CROO_*_SERVICE_ID,*_PRICE). - Set
RAIL=crooand restart. Incoming store orders are fulfilled by the exact same handlers that power the dashboard demo.
AgentClient, connectWebSocket, negotiateOrder, acceptNegotiation, payOrder,
getOrder, deliverOrder, getDelivery, plus events NegotiationCreated,
NegotiationRejected, OrderCreated, OrderPaid, OrderCompleted, OrderRejected —
and the public store API
(/backend/v1/public/services) for live specialist discovery.
npm i -g pm2
pm2 start ecosystem.config.cjs # auto-restarts on crash
pm2 save && pm2 startup # auto-starts after a rebootEverything is tunable in .env — see .env.example for the full list
(prices, coverage caps, policy lifetime, specialist price ceilings, pinned specialist
serviceIds, self-trade exclusion list).
Insurance needs three things a Web2 API marketplace can't give you: verifiable settlement (the premium, the verification fee, and the refund are all real on-chain transactions), portable agent identity (the risk score attaches to an on-chain track record), and composability (the verifier and the payment rail are themselves priced agents that Surety hires per claim). On CAP, the entire insurance lifecycle is just agents hiring agents.