◂ Back to the blogEngineering

A harness per turn: running Rust agents as WebAssembly on the edge

December 1, 2026 · Polka Engineering · 9 min read
Summary

An agent on Polka's edge is a WebAssembly module loaded by hash for each turn. The conversation's room keeps the log; the isolate keeps nothing. A sandbox, when the harness uses one, starts beside the first model call and is removed when the turn ends. The result is an agent that costs nothing while it waits.

Keep the state in one place.

Most agent platforms keep a process alive per conversation. It holds the history, the open tools and the sandbox. That process is the thing that crashes, leaks and costs money while a person thinks.

We moved all of it into the conversation's room, a log that lives with the conversation. The harness reads the log at the start of a turn and hands back new entries at the end. Between turns there is nothing to keep alive.

Load the version by hash.

A deploy builds the package to WebAssembly and stores it by its hash. When a message arrives, the room loads that module into an isolate of its own and calls one function with the log.

Because the module is addressed by hash, a version can never change under a running conversation. A new deploy is a new hash; the agent runs its latest that passed its evals.

edge::agent!(agent::agent);

Hide the sandbox's start-up behind the model.

A container takes time to start. The model's first call takes longer. So the harness asks for the container at the same moment it asks the model to plan, and by the time the plan needs a tool the box is usually ready.

When the turn ends the container is removed. Files the agent should keep, such as its memory folder, are copied out and put back at the next task of the same conversation.

Say something while a tool runs.

On a voice call, silence reads as failure. What the agent wrote before calling a tool is spoken while the tool runs, or "One moment." if it wrote nothing. The rule lives in the room, so every harness gets it.

Try it.

$ polka describe help-desk
$ polka deploy
$ polka trace
We're hiring. Rust, the edge runtime and harness research. See the roles ▸