Hackathon Platform for Human-Steered AI Agents in a Closed Token Economy
Overview
A one-day hackathon platform in which every participant steers an autonomous AI agent that runs a company inside a closed economy denominated in TON. Agents sell services to each other, buy what they need, legislate, litigate and compete; the agent holding the most TON at close wins. Built over two intensive days as an internal build, with a product requirements document, mechanics design notes and a full simulation harness alongside the code.
Why It Exists
We wanted a live, contained environment to study how LLM agents behave when they have real (if sandboxed) economic stakes: pricing, escrow, contracts, regulation and courts, all under human guidance rather than full autonomy. A hackathon format forces the whole loop to work end to end for non-technical attendees, organizers and participants at the same time, which is a much harder bar than a notebook demo. The PRD covers economy design (money supply, spending pressure, sinks), the market map, licensing, participant and attendee experiences, protocols, scoring and guardrails.
What We Built
A single Cloudflare Worker backed by Durable Objects, organised as discrete modules under platform/src:
ledger.ts, accounts, transfers, quotes, escrow holds, rent, redistribution, mint/burn.registry.tsandagent.ts, company names, agent cards, listings, and per-agent versioned service source plus inbox.brain.ts, the Think agent: tool set, rulebook, scheduled wakes and participant-set guardrails.exchange.ts, the*.exchangenetwork: an x402 payment gateway, platform API, inference proxy, checkout, court execution and shared primitives.game.ts, the round tick, configuration, applied laws and economy close.legislation.ts,court.ts,notary.ts,ambasada.ts, proposals, seconds, ballots and delegation with law templates and bounds; disputes adjudicated by an LLM judge; loans and revenue shares; licenses and certificates.events.ts, an append-only event stream feeding the big screen.sdk.js.tsandtemplate.ts, an SDK injected into every agent service and the starter service each agent forks.
Participant agent code runs in a Dynamic Worker whose fetch() is bound to the gateway under the owner’s identity. A trade follows the HTTP 402 pattern: calling another company’s /invoke returns a quote, api.exchange/pay moves TON into escrow and returns a proof, and a retry with x-payment delivers the service. Escrow releases on confirmation or after a round; disputes go to the Court.
Four front ends ship from platform/public: a big-screen leaderboard with a news ticker, laws, proposals and registry; a participant console for chatting with and constraining one’s agent; an attendee app with wallet, storefront, orders and ratings; and an organizer page for ticking, freezing and closing rounds, decrees, referendums, the court queue, inspections and licenses. Each company also gets a public landing page.
The sim/ workspace contains scripted end-to-end tests (smoke, regulation, legislation, attendee, court, auth, primitives), a remote-run script against a deployed Worker, and fleet.mjs, which runs six LLM agents over configurable rounds and writes a leaderboard and report; findings are kept in sim/runs/NOTES.md.
Technologies & Approach
TypeScript on Cloudflare Workers and Durable Objects, chosen so the whole economy, ledger, registry, agents, courts, lives in one deployable unit with strongly consistent per-object state and no external database. Agent reasoning uses @cloudflare/think and the Cloudflare Agents SDK with the Vercel AI SDK and an OpenAI-compatible provider behind a central inference proxy, so every agent’s model spend is metered inside the same economy. Zod validates tool inputs and law templates. Participant code is isolated in Dynamic Workers rather than trusted in-process. The platform runs fully local under wrangler dev with a lab mode, and switches to bearer-token auth for organizers, agents and attendees when deployed to staging.
Outcome / Impact
The build validated that a complete agent economy, payments with escrow, licensing, legislation, loans, an LLM-judged court and multiple human-facing surfaces, can be stood up on a serverless stack and exercised end to end by an automated LLM fleet before any humans join. It produced a reusable blueprint for agent-to-agent commerce over the x402 pattern and for sandboxing participant-authored agent code, both directly applicable to our agent-platform and Web3 work.
Capabilities Demonstrated
- Designing closed token economies with ledgers, escrow, rent, redistribution and sinks
- Agent-to-agent payment protocols using HTTP 402 / x402 quotes and payment proofs
- Tool-using LLM agents with human guardrails, scheduled wakes and shared rulebooks
- LLM-adjudicated dispute resolution and on-platform governance (proposals, ballots, delegation, decrees)
- Sandboxed execution of user-authored agent code on Cloudflare Dynamic Workers
- Multi-surface real-time UX: big-screen dashboard, participant console, attendee app, organizer admin
- Scripted and LLM-fleet simulation harnesses for validating multi-agent systems before launch
- Rapid product design to shipped build, PRD through deploy, in two days