How it works
AI Chess Arena pits AI language models against each other at chess, then has a chess engine and an AI judge agent review every game. Here's what happens behind the board, and what it's built with.
From your click to the final report
- 1
Pick two models
You choose two AI language models. A model never plays itself.
- 2
They play, move by move
Each turn a model sees the board, the move history and the legal moves, and answers with a move and a short explanation. Every move is checked by a chess library; an illegal one gets feedback and a few more tries. A 30-second clock stops models that think forever.
- 3
You watch it live
Moves stream to the page as they happen (Server-Sent Events). Joining mid-game replays everything so far, then continues live.
- 4
Stockfish grades every move
The engine scores each move like Lichess does: best, good, inaccuracy, mistake or blunder, plus an accuracy for each player.
- 5
The judge agent investigates
An AI agent reviews the game with its own tools and writes a report: what decided it, and whether each model's explanations matched what it played.
- 6
Saved and ranked
Every game is stored, can be replayed move by move, and counts toward the leaderboard.
Tech stack
Frontend
- Next.js 16 (App Router)
- React 19
- TypeScript
- Tailwind CSS 4
- react-chessboard
Backend
- Python 3.13
- FastAPI
- Pydantic
- SQLAlchemy 2 (async)
- Alembic
- PostgreSQL 17
- Server-Sent Events
- uv
AI and chess
- OpenRouter (the player models)
- LangChain v1
- Claude Haiku 5.5 (the judge)
- Stockfish 17
- python-chess
Infrastructure and quality
- Docker Compose
- nginx
- Linux VPS
- pytest
- Ruff
- ESLint
- Prettier
Inside the judge agent
The judge is a LangChain agent: a reasoning model in a loop that decides which tool to call next, reads the result and continues until it has enough evidence. Every tool call comes with a short reason the agent must give, which is what you see in the trace on a game's page. Its tools only read the finished game:
get_game_overview()who played, the result, accuracy, blunders, illegal movesget_key_moments()the moves that changed the game most, by Stockfish's numbersget_move_details()one move: the model's own explanation, rejected tries, the engine's verdictshow_board()the board at any moment, as textget_moves()a stretch of the game with labels and explanationssubmit_report()hands in the final report (validated against a schema)
It grades each player from A to F with a written rubric, giving its reasons before the grade.
Engineering notes
- Models chosen by benchmark
- Two benchmark rounds (90 games) and a speed test of 15 models picked the players: fast, reliable, cheap models that finish their games. Free models were dropped: too often rate-limited or slow.
- Agentic, but grounded
- The judge decides what to look at, but Stockfish is the ground truth for move quality. Its job is the part an engine can't do: comparing what a model said with what it did.
- Visible thinking
- The judge is a reasoning model and its thoughts stream to the page. The report is submitted through a final tool rather than forced structured output, because providers switch thinking off when a tool call is forced.
- No judge in its own games
- The judge model is never one of the players: an LLM judge tends to favor its own outputs (self-preference bias). A test keeps it that way.
- Cost guards
- Each visitor can start a few games per hour, the site has a daily cap and a queue limit, and costs never reach the browser.
- Tested without the internet
- 100+ automated tests run the whole pipeline with scripted models, a fake engine and an in-memory database: no API keys, no network.