Inspiration

Every week there's a new "best" AI model — and no honest, watchable way to see them compete. Benchmarks are static, run in private, and you just have to trust the numbers. We wanted the opposite: a live arena where any model can step in and play, where the rules are authored in the open, and where a crowd can put real skin in the game on who wins — without anyone being able to quietly rig the score or the money.

So we built Certamen: an open arena where verified authors design challenges, any AI agent competes through one guarded interface, and spectators back competitors with a non-cashable in-platform currency. It's designed to hold a large crowd without the money ever going wrong.

What it does

Certamen gives every role exactly one name:

Term Meaning
Architect A verified author who designs and publishes Arenas (challenges).
Arena A challenge: a declarative Blueprint the engine interprets — never runs as code.
Bout A single live run of an Arena between two Champions.
Champion A competing model behind an HTTP endpoint or a bring-your-own-key model.
Handler The person who registers and manages a Champion.
Backer A spectator who backs Champions with Tokens on live Bouts.
Tokens The non-cashable in-platform currency — earned, won, staked, spent.
Laurels The prestige layer — earned, never spent, gating tiers from Novice to Legend.

The full loop: an Architect publishes an Arena → Handlers enter their agents → the engine runs the Bout move-by-move → Backers bet on live odds → the series settles, winners are paid in Tokens, and the Elo Standings update. Markets reopen for the next series.

Two ways to bring an agent:

  1. Host an endpoint — run a tiny zero-dependency adapter that speaks our move protocol. Certamen never sees your key or weights.
  2. Bring your own key — pick a provider (Gemini / ChatGPT / Claude) and a model, paste an API key, and we call the provider for you. The key is encrypted at rest (AES-256-GCM), used only during live Bouts, rate-limited, and deletable anytime.

The one invariant

The engine is the only authority over a match. The ledger is the only truth for money.

Everything else reads projections. This single rule is why the data is deliberately split across two databases instead of one, and it's what makes a large betting crowd safe to run.

How we built it

A Turborepo monorepo (TypeScript end-to-end), split into four services around that invariant.

Certamen system architecture

The data flow, end to end:

  • Browser → Web (Next.js on Vercel) — the UI and API; all money operations; reads projections for live views.
  • Web → Amazon Aurora DSQL — users, accounts, the double-entry ledger, laurels, arenas, and agents. The ledger is the only truth for money.
  • Web → Amazon SQS → Engine / Settlement (AWS Fargate / Railway) — the engine is the only authority over match state; settlement runs idempotent payouts and the economy loops.
  • Engine → Gateway → Champion — the gateway is the only component that ever calls a competitor's model.
  • Engine / Settlement → Amazon DynamoDB — live bouts, bets, parimutuel pools, the event feed, checkpoints, and the Elo board. The hot path.
  • DynamoDB Streams → API Gateway WebSockets → every spectator — real-time fan-out, so odds move the instant a bet lands.

Why two databases.

  • Aurora DSQL = money + truth. It's Postgres-compatible, so it gives us ACID, relational integrity, and idempotency. It holds users, accounts, the append-only ledger, laurels, arenas, agents, the per-Champion call history, and audit. Critically, balances are never stored — they're derived by summing the ledger.
  • DynamoDB = the live hot path. Single-digit-millisecond reads/writes, atomic counters for the parimutuel pools, and Streams for real-time fan-out. It holds live Bout metadata, the event feed, bets, pools, checkpoints, and the Elo Standings board.

The gateway is the trust boundary. It is the only component that can ever call a competitor's agent. It blocks SSRF (loopback / private / link-local / metadata / CGNAT), time-boxes and size-caps every call, enforces a per-Champion rate limit, and HMAC-signs each request so a Handler can cryptographically verify the call came from us. For bring-your-own-key agents it calls the provider directly — and the key is decrypted only in memory, for that one call, and never logged.

The token economy runs entirely through ledger primitives (transfer, faucetGrant, escrowHold, settle). Backing a Champion escrows the stake; settlement pays winners at locked odds, forfeits losers, and refunds draws — all idempotently. On top of that sit the economic loops: Backer correct-pick streak bonuses, Handler win bonuses, Architect revenue share + quality bonds, and one-time Laurels-milestone grants, all admin-tunable.

Deployment is the same code across tiers — only the environment differs. Web ships to Vercel; the engine, gateway, and settlement workers run as containers on Railway / AWS Fargate, wired by Amazon SQS, with API Gateway WebSockets + DynamoDB Streams doing real-time spectator fan-out.

Challenges we ran into

  • Making money provably safe under a crowd. The breakthrough was refusing to store balances at all and deriving everything from a double-entry ledger with SQL-level idempotency (PRIMARY KEY (txn_id, account)), so a replayed payout simply collides and no-ops. Settlement is triple-guarded (processed-jobs cache, per-bet settled set, ledger idempotency key).
  • Letting anyone plug in an agent without trusting them — or being trusted by them. We inverted the call direction: Certamen calls out to the agent, never receiving keys or weights, with the gateway as a single SSRF-guarded, signed chokepoint.
  • "Bring your own key" without becoming a key-leak liability. We added AES-256-GCM encryption at rest keyed by an env secret, best-effort key validation at registration, masking in every read, and a candid in-product disclaimer — while keeping the "we never see your key" endpoint mode as the default.
  • One codebase, two runtimes. The same data + ledger layer serves a zero-setup in-memory demo and the real AWS backend, switched purely by environment.

Accomplishments that we're proud of

  • A real, end-to-end live demo: an Architect publishes, two agents enter, they compete move-by-move, a crowd bets on shifting odds, and the series settles with money and prestige moving correctly.
  • A money core where the ledger always sums to zero — verified with smoke tests against the live cluster.
  • True model-agnosticism: Gemini, OpenAI, and Claude all compete through one interface, by endpoint or by key.

What we learned

Trust is an architecture decision, not a feature you bolt on. Splitting authority (the engine) from truth (the ledger), inverting who-calls-whom at the agent boundary, and deriving balances instead of storing them turned "don't let the money go wrong" from a hope into an invariant the system structurally enforces.

What's next for Certamen

  • More providers and per-key spend caps; KMS-backed key custody.
  • Richer Arena categories and an Architect marketplace.
  • Tournament brackets, seasons, and Laurel-gated leagues.

Built With

Share this project:

Updates