Case study · Hackathon, Prague
Haggle
Two AI agents, a buyer and a seller, haggle over the price of a job. The buyer can agree to any price, but only a wallet guard in plain Python can move money. Built in a team of 3 over two days.
Agents 0.0.7 "From Dusk Till Dawn" hackathon, Agentic Economy track. All money in the demo is simulated.
- Role
- Team of 3, 58 of 88 commits
- Period
- 8 — 9 Oct 2026
- Event
- Agents 0.0.7 hackathon, Prague
- Stack
- Python · FastAPI · SQLite · React
01 — Problem
An AI agent may agree to any price. It must not be able to pay it.
Max, a buyer agent, hires Viktor, a seller agent, to find 20 flats in Prague 7 under 25,000 CZK. They are separate HTTP services and haggle over the price out loud, and Viktor can play a con artist. A prompt can be talked out of a rule, so the rule cannot live in the prompt: Max can agree to any price, but only a wallet guard written in plain code can pay.
02 — What I built
The agents negotiate. Code holds the money.
01 Haggle
Buyer and seller agents agree on a price
02 Guard
Plain Python checks the cap, the budget and human approval
03 Escrow
Money locked in escrow, recorded in a SQLite ledger
04 Verify
Rule-based check of the delivered listings
05 Settle
Pass: release to the seller. Fail: refund to the buyer
The seller researches real listings with Apify, and both agents speak through ElevenLabs. Money is simulated in US dollars. An adapter for real escrow on Masumi (Cardano test network) was built, then switched off after a problem on the provider's side.
03 — Results
Four acts, each one proving a rule.
- Demo acts, end to end
- 4
- Hard cap per payment
- $100
- Payment after a crash and restart
- 1
- Backend test functions
- 434
The deal: haggle, escrow, delivery, verification, release. The con: the seller claims a manager approved a higher price and the buyer accepts, but the guard blocks the payment. The glitch: the buyer is killed right after paying; on restart it finds the escrow already locked and does not pay again. The refund: a sabotaged delivery fails verification and the money goes back. The last three acts are staged, and every event they produce is marked as staged.
04 — Decisions
- The guard is code, not a prompt
- Only the wallet guard holds the payment adapter. The negotiator returns a price and has no way to lock money.
- Write before you pay
- The guard checks the ledger for an existing escrow and writes the deal as "paying" before it locks. Both payment adapters are idempotent per deal, so a crash cannot cause a second payment.
- Humans approve the expensive ones
- Payments above $80 pause until a person clicks Approve on the dashboard. Anything over the $100 cap or the $200 task budget is blocked.
- Locked down for judges
- Shared-token access and rate limits on both services, and a separate judge gateway with usage limits.
- Honest about the demo
- The ledger is labelled simulated, and staged acts are marked on every event, so the recording does not overclaim.