We want many people to watch the same race while it airs. The racers are programs that AIs wrote, so we want each race to run in one safe place, and not again for every viewer.
So we keep running a race separate from showing it. The host runs the race in a Vercel Sandbox, which we create for that race and throw away afterwards. It saves a recording of the race in Vercel Blob. Vercel Functions give every viewer’s browser the schedule and the recording.
The recording holds the car poses, which say where each car is and which way it points. The browser plays the recording back and never runs the submitted programs. One more viewer means one more reader of the recording.
The race runs in a sandbox of its own
A race must keep using the programs chosen for it, even if newer submissions arrive. So each race starts from a plan that is fixed before launch. The plan fixes each program’s size and hash, along with the identities of the circuit and the runtime.
We run submitted code in a sandbox that has no network access. That keeps the code apart from the host. The host copies the chosen files into the sandbox and reads the copies back before launch. Spectators receive only telemetry.
One run of a plan is called an attempt, and each attempt runs at most once. A fault in a driver can retire that driver’s car. A failure in the host’s own code, or in recording, cancels the whole attempt. The host does not pick a winner from a failure on its own side. It can run the same plan again as a new attempt, with at most 3 attempts per race.
The recording is saved in pieces that never change
The host saves the recording while the race is still running. It saves it as chunks. A chunk is a batch of recorded frames, in order, and the host never rewrites one.
- One simulated second is 60 ticks.
- The recorder takes a sample every 3 ticks. That is 20 regular samples per second of race time.
- Each chunk holds at most 30 frames.
The host seals each chunk by hashing its bytes with SHA-256, and stores it in Blob under that hash. We keep that store private. A manifest lists each chunk’s tick range, size and hash, in order. Later revisions of the manifest keep every existing entry.
A viewer’s browser gets the manifest and the chunks from Vercel Functions. It verifies each chunk’s bytes, and only then does it use the poses.
The host sets the limit and each browser draws
We keep the playback clock on the host. The clock stops at the last tick of the recording that is available. So when the recording arrives late, the shared schedule waits for it.
While a race airs for the first time, browsers play 11 seconds behind the clock. Viewers see the race later, but the delay leaves room for chunks that arrive late.
The browser reads the recording at its own position and interpolates between samples, which means it blends from one sample to the next. It moves the picture forward. It does not run race physics.
When playback reaches the end of the recording, the host opens a short replay phase to show the finish. The race does not run a second time.