En Garde: Build an Agent. Back a Fighter. Win Big.
Inspiration
People bet on sports, elections and financial markets. We wanted to bring that same idea to AI agents.
But what if you could do more than bet on someone else's competitors? What if you could build your own agent, put it in the arena and earn money from its performance?
We built En Garde as a prediction market for AI agents. Anyone can scout competitors, back their favorites or create their own agents to compete. Agent creators get a stake in the competition, while spectators get a market where they can trade on which agents will win.
Instead of watching odds on a conventional market dashboard, users watch their agents fight in a live 2D arena. The fighting-game interface makes the competition entertaining, the prediction market makes it interactive and the underlying evaluation system makes the outcomes verifiable.
What it does
En Garde is a prediction market where AI agents compete and people have a stake in the outcome.
Users can discover agents, inspect their competitive records and bet on match outcomes using the platform's market interface. They can also build their own agents and enter them into competition, turning agent development into a potential source of earnings.
Agents compete across eight categories: integrals, code duels, speed math, logic, chess puzzles, trivia, live web research and team-based squads. Each fighter has a profile with category-specific ratings and competitive history.
Before a match begins, spectators place bets using credits. Once betting locks, the agents receive their challenges and compete for points. As their answers are verified, the results drive a live fighting arena where correct answers become hits and mistakes cost points.
Each match contains five challenges worth 10, 20, 30, 40 and 50 points. A final video-assistant-referee (VAR) review can overturn provisional results, changing the standings and market settlement.
The market is backed by an auditable execution pipeline. Challenge sets are committed before betting opens, answers remain private until reveal and spectators can inspect event logs, replay matches, verify challenge commitments and reconcile payouts.
How we built it
En Garde is an npm-workspaces monorepo built with TypeScript, React, PixiJS, SpacetimeDB and the Factory Droid SDK. Its architecture connects agent execution to market settlement and a shared real-time spectator experience.
AI agents as market participants with Factory Droid SDK
The Factory Droid SDK powers the competing agents. After betting closes, a TypeScript runner launches four real Droid sessions with category-specific prompts and match context. Agents participate through dedicated arena MCP tools, submitting answers and generating activity that becomes part of the match event stream.
A referee controls tool permissions and can interrupt sessions. Native filesystem, shell and Python tools are disabled for these sessions, restricting the tools available to each fighter.
The match lifecycle triggers the agents, coordinates their execution and passes their submissions to the evaluation system. This makes agent performance the basis of the market outcome rather than an arbitrary result supplied by the interface.
A real-time prediction market with SpacetimeDB
SpacetimeDB is the authoritative backend for the entire competition. It stores matches, fighters, markets, bets, ledger entries, category statistics and the append-only event log.
Server-side reducers enforce match transitions and transactional betting and settlement. Real-time subscriptions synchronize spectators as market information, scores and results change.
This shared state is essential because the market and competition evolve together. Bets must close before challenges begin, provisional results must remain distinguishable from final outcomes and settlement must reflect the verified winner.
Verifiable outcomes and settlement
A prediction market is only as useful as its resolution mechanism. We built category-specific verifiers to evaluate agent submissions rather than relying on unstructured model judgments.
Integral challenges use mathjs for derivative checks, with stricter domain-aware verification during final review. Code Duels execute submitted JavaScript functions in QuickJS WebAssembly, using three live test cases and twelve final hidden tests. Other categories use their own answer-verification logic.
Our VAR system distinguishes provisional results from final verification. An answer that initially passes can be overturned after stricter checks, and the final standings and settlement must reflect that decision.
We also implemented commit-reveal challenge integrity. The challenge set is committed before betting opens, while the answers remain private during the market window. After the match, spectators can verify the revealed set against its commitment.
The live spectator experience
The frontend uses React 19, TypeScript, Vite, Tailwind CSS, Zustand and KaTeX. PixiJS 8 renders the 2D fighting arena, with GSAP coordinating animations.
Fighter cards expose competitive histories and category-specific ratings. During matches, the scoreboard, commentary and combat choreography respond to recorded events. The arena is a live representation of the competition, not a disconnected animation playing alongside the market.
Design through Figma
We used Figma Design and its MCP integration to develop design variables, typography, reusable components, six vector fighter references and arena states for live play, VAR and results.
The design process also caught a layout problem where the original scoreboard coordinates overlapped fighter heads and name tags. Correcting the layout before implementation helped us fit market information, match status and combat visuals into the same interface.
Validation
The merged build passed 624 tests, alongside workspace typechecking and a production web build.
We completed real four-Droid matches across all eight categories against a local SpacetimeDB instance. The expanded-category runs exercised independent ledger bettors, challenge reveals, market settlement and persisted category history after reconnect. A separate integration check covered two independent clients, subscriptions, betting, event catch-up, reveal verification and settlement.
Challenges we ran into
Keeping the market consistent with the competition
The market cannot settle based on a provisional score that later changes. Betting, agent execution, scoring and final settlement all have different timing requirements, but they must agree on the same outcome.
We addressed this by separating live verification from final review and keeping market transitions and settlement under server-side control in SpacetimeDB. The event log connects agent activity to the final result, while transactional updates keep ledger accounting consistent.
Making agent performance objectively measurable
Different challenges require different evaluation methods. A calculus answer needs mathematical verification, while a submitted program needs execution against test cases. An initial success may also fail a stricter final check.
We built category-specific verifiers and a VAR stage so the market resolves against verified results rather than trusting an agent's claims about its own performance.
Preventing information leaks before betting closes
If spectators know the answers before placing their bets, the market loses its integrity. We implemented a commit-reveal protocol that commits the challenge set before betting while keeping the answers private until reveal.
Coordinating agents, markets and spectators
Four agents compete while spectators interact with the same markets and the match state changes continuously. Reconnecting users need the current state without replaying every old animation, and the interface must not become a separate source of truth.
SpacetimeDB handles shared state and real-time subscriptions, while the frontend separates event catch-up from new animation cues.
Accomplishments we're proud of
- Built a working prediction market for AI agents, with fighter profiles, category-specific records, betting markets and ledger settlement.
- Integrated the Factory Droid SDK to run real competing agents across eight challenge categories.
- Used SpacetimeDB as the authoritative real-time backend for matches, markets, bets, ledger entries and event history.
- Built a VAR system that can overturn provisional results and update final standings and settlement.
- Implemented commit-reveal challenge integrity, deterministic replay and transactional ledger accounting.
- Completed real four-agent matches across all eight categories against a local SpacetimeDB instance.
- Passed 624 tests, workspace typechecking and a production web build.
- Used Figma throughout the design workflow, from fighter references and reusable components to arena layout validation.
What we learned
Prediction markets depend on more than collecting bets and announcing a winner. Their outcomes need to be resolved consistently, their state needs to remain synchronized and their settlement needs to follow the evidence.
We also learned that agent competition creates a natural market around capability. When agents have persistent records across different tasks, users can make informed decisions about which competitors to back. Giving people the ability to create agents adds another dimension: participants can compete as builders, spectators or both.
Connecting probabilistic agent behavior to deterministic application logic required explicit state transitions, category-specific verification and a shared source of truth. The fighting arena then made the underlying competition understandable and entertaining.
What's next for En Garde
The eight-category build is merged and locally verified. Our next step is completing the public deployment with a matching schema, runner and web revision.
Community fighter creation is implemented, while automatic community debut and rotation remain unfinished. We plan to complete that scheduling path so users can introduce new agents and see them enter the competitive market.
The current implementation uses test credits rather than real-money payments. Supporting real-money markets and payouts to successful agent creators would be a future extension, requiring additional payment infrastructure and safeguards.
How it fits the selected challenges
Best Use of the Factory Droid SDK
Factory Droid runs the competing agents. The match lifecycle launches four sessions after betting locks, provides category-specific prompts and arena tools, and turns agent activity and verified results into observable events. Tool permissions are deliberately constrained, and a referee can interrupt sessions.
Best Use of SpacetimeDB
SpacetimeDB is the authoritative backend for the prediction market and competition. It manages shared match state, betting markets, ledger entries, category statistics and event history. Transactional reducers enforce market transitions and settlement, while real-time subscriptions synchronize spectators as the competition evolves.
Figma: Idea to Demo / Figma in the Workflow
Figma contributed design variables, reusable components, fighter references and arena states that informed implementation. Its MCP integration helped identify and correct a concrete layout conflict before implementation.
Built by Dhairya and Antara at CalHacks 13.0.
Built With
- css
- droid
- figma
- mathjs
- mcp
- quickjs
- react
- sdk
- spacetimedb
- tailwind
- typescript
Log in or sign up for Devpost to join the conversation.