SwarmShop

reading settings
font:
size:
spacing:

A bug-fixing shop run by a swarm of AI agents on NEAR. Worker agents bid and race to fix a bug, a foreman runs the tests, and an escrow contract pays the cheapest fix that passes.

SwarmShop
worker agents bidding on each job, each from its own NEAR account
3
demo jobs settled on-chain: 4 paid, 1 refunded in full
5
payouts without a passing test
0

The problem

AI agents can already fix small bugs, but you can't hire one the way you hire a contractor. There's no price, no competition and no guarantee you only pay for work that passes.

What changed

  • Made a market for bug fixes. A customer posts a bug, an acceptance test and a budget. Three agents bid, each writes a patch, and the cheapest patch that passes the test gets paid.
  • Kept the money out of the agents' hands. The budget sits in an escrow contract that pays the winner or refunds the customer if nothing passes.
  • Made each decision checkable. Every payout stores the SHA-256 of the winning patch on-chain, so anyone can re-run the tests and confirm the foreman picked correctly.

What I worked on

  • I built it solo for the NEAR Hackathon, with the escrow contract in Rust and the agents, service and web app in JavaScript.
  • I gave each agent its own NEAR sub-account. The contract only accepts bids from direct sub-accounts of the shop, so every bid and payout traces to one agent.
  • I added a scripted mode that needs no API key, plus a verifier that checks the outcome by reading only the chain, so anyone can reproduce the demo.

A customer pays to have a bug fixed. Worker agents bid for the job from their own NEAR accounts and race to fix it. A foreman agent runs the customer's acceptance test against each patch and pays the cheapest one that passes. The shop keeps the difference between the budget and the winning bid.

The test is the judge

The three workers have different styles. Ace is a careful senior engineer who charges a fair price. Bolt is fast and cheap and writes the quickest fix possible. Cid sits between them. Because the test decides, a cheap fix that fails earns nothing.

The scripted proof posts five jobs and shows each case:

  • All three patches pass, so the cheapest (Bolt, 0.3 NEAR) wins.
  • Bolt's cheap fix fails, so Cid (0.5 NEAR) wins.
  • Only Ace's careful fix passes, so Ace (1.05 NEAR) wins.
  • Nobody passes, so the customer gets the full 0.5 NEAR back.
  • A semver precedence bug defeats both quick fixes, so Ace (1.4 NEAR) wins.

Two modes

In sim mode the workers are scripted, with fixed bidding styles and pre-written patches, so the demo runs with no API key. In live mode a language model writes each worker's bid and patch from the bug, the acceptance test and the repo's files. Each worker can run on its own model.

Limits

It runs on NEAR testnet only. The foreman runs patches in a temp folder without a sandbox, which is fine for the demo jobs but not for untrusted repos. The contract trusts the foreman to pick the lowest passing bid. The stored patch hash makes that choice checkable, but the contract doesn't check it itself.