Most bot harnesses are built around one conversation: one person, one thread, one turn at a time. The agent's state belongs to that thread, so nothing else can change it while the agent works.

The agents we build for Zerbly work differently. One agent talks to many people at once, and its turns run concurrently, each in its own thread. Those threads share one state: the agent's permissioned memory, its notes and the calendar it manages. That calls for a different kind of harness: one with multi-threading built in.

Imagine one of these agents scheduling a meeting with twenty people. Each person talks to it in their own conversation. The agent keeps its working notes in a file: who's free, which slots are held, and who has confirmed.

Now Ana and Ben both message it at the same moment. Each conversation reads the notes, and both see that Thursday at 2pm is open. If both turns go ahead, Ana and Ben are each offered Thursday at 2pm. Same slot, offered twice, and one of them is about to be disappointed.

This isn't a model problem. A perfect model makes the same mistake, because each turn read the same notes and neither could see the other. It's a concurrency problem, and harnesses built for one thread don't handle it. In a multi-threaded agent it's the normal case. Our harness handles it with one rule: commit before you show. Nothing an agent says to a person, and nothing it does in the outside world, leaves the system until the work behind it is committed.

Here's how that works in the AI constructs that run Zerbly's bots.

A construct serves many people across many lanes: direct messages, group threads, channels and calls. In our hosted configuration, one construct runs up to 25 conversation turns at the same time and queues any beyond that. Those lanes share state. Person facts such as a name, timezone or quiet hours are visible in every lane that can see that person, and the construct keeps its own files, like that scheduling note.

In our hosted deployment, each construct is a Cloudflare Durable Object with its own SQLite database, and its files live in that database. Between messages nothing runs. Cloudflare evicts an idle object, and an alarm wakes it when a wait or a reminder comes due.

When the agent works, the model writes small TypeScript cells and runs them. Each cell runs as a preview on a copy-on-write (CoW) branch of the construct's database. The branch is pinned to the latest committed revision, and the preview's writes are stored as private row versions.

So Ana's turn can read the notes, mark Thursday 2pm "held for Ana" and draft a reply that offers it. Ben's turn can do exactly the same on its own CoW branch. The model sees those results. Nobody else does: no reply has been sent, and the notes on main haven't changed.

A cell that fails contributes nothing, and the next cell starts from the last one that succeeded. Model calls hold no database transaction while they wait.

When the agent wants its work to count, it commits. The construct's scheduler collects the previews that are ready, orders them by causal prerequisites, and replays them once against the current state, inside one transaction.

Replay doesn't trust the preview. It runs the reads again and compares what they return with what the preview saw. Reading a file is one of those checked observations: the file's contents are part of the comparison.

  • Ana's turn replays first. The notes still say Thursday 2pm is open, so her replay matches, and her hold is written inside the transaction.
  • Ben's turn replays next in the same transaction, so it reads the notes with Ana's hold. Its read no longer matches what the preview saw. The whole transaction rolls back, Ana's staged hold included, and nothing is shown to anyone. The agent is told Ben's replay diverged.
  • The queue tries again without Ben. Ana's turn replays on its own, matches and commits: her note edit and her reply land together, and only then is the reply handed to her channel. Ben's turn discards its preview and starts over from the latest committed notes, and this time it offers Ben 3pm.

Ben never sees the 2pm offer, because it never existed outside a branch. The closest analogy is a merge queue: a pull request that passed CI against an old main is rebuilt against the current main before it lands. Here the change is to the agent's notes instead of to code.

The notes are the agent's working memory, not the calendar. Writing the meeting into the actual scheduling tool is an external effect, and you can't roll an external effect back. So it doesn't run inside the script.

A tool call that changes something outside the construct becomes a workflow start. (An MCP tool runs directly only if its server is trusted as read-only and the tool is marked read-only and non-destructive.) During preview, the start is only an intent row on the branch, so Ben's discarded preview takes its calendar write with it. If a later cell in the same operation starts the same request again, it gets the original workflow back instead of a second one. At commit, the workflow instance is created inside the commit transaction. It runs only after that transaction is durable, and that's when the calendar is actually written.

One person, one thread, one turn at a time was a fine place to start. Bots that serve a team, a front desk or a community don't work that way. They hold many conversations at once over shared memory, and every message they send has to be true when it's sent. That's what we're building: multi-threading for bot harnesses, with commit before you show as the rule underneath.


Other teams are reaching related ideas from different directions:

  • pi-durable, from the team behind Pi, is an experimental durable harness for coding agents. It commits a tool call's intent before the tool runs, and after a crash it reruns the call only if it's declared replay-safe. Its README also states its own limit: streaming partial output is committed in memory about every 100 ms and reaches storage within about a second.
  • Infinity treats an idle agent as pure data: "between turns, an agent is just its conversation history, with no task, no stack, and no open connection." Its Reactive Agent Protocol invokes a tool with one POST that carries a callback URL. Infinity's agents share nothing and talk through mailboxes. Ours share notes between people, which is why we added preview and a commit queue on top of the same idea of cheap idle time.
  • LayerFS gives each agent "a complete, writable Workspace over shared committed history". The agent does its work, commits what changed and goes away. That's the same commit-then-share shape, applied to files.
  • dquickts is a QuickJS fork that can pause a running script, serialize its whole heap and resume it later in another process, including while the script waits on a host call. We don't use it. Our notebooks take the opposite approach and rebuild state by replaying recorded results, but it's a direct relative of our script sandbox.