Tech Demos

Actor lab

Persisted fields and a one-at-a-time mailbox, on Durable Objects

Upstream Contact

What this shows A few updates read one counter, wait on Workers AI, and write back. The mailbox lines them up. An open input gate lets them overwrite each other.

Checking whether AI runs are unlocked…

Race lab

Each racer reads the counter, awaits the model, then writes read + 1.

Execution
A few updates

Fire a run to see who read the counter, who waited, and who wrote back.

Read, wait, and write for each racer
RacerReadWaitWrote

Room actor

Hibernating WebSocket. Messages are SQLite. Scratch is isolate memory and also disappears when the room hibernates after about 10 seconds with no messages.

What the race is showing

Input gate

This actor is one JavaScript thread. While it waits on SQLite, Cloudflare does not start the next request. When it waits on Workers AI, that hold lifts, and another update can read the same counter before this one writes.

Output gate

The response stays here until the SQLite write is confirmed. If the actor is evicted first, the write rolls back and the caller gets an error instead of a success that never landed.

Mailbox and blockConcurrencyWhile

Serialized mode is the durable-actors default: handlers take a number and run one at a time, even during the model wait. Interleaved mode is their @Interleave opt-out. blockConcurrencyWhile keeps the input gate shut for a whole wait. This actor uses it only while loading SQLite. Holding it across Workers AI would stall every other event for as long as the model takes, so the mailbox does that job instead.