Stories

A thousand agents, one Elixir kernel

Agents do their shell, file, and data work through a persistent Elixir workspace on every machine. The runtime was built for exactly this.

Agents in this repo do not run loose shell commands. Every session talks to a kernel: a persistent workspace where variables survive across calls, jobs run supervised in the background, and a session can reconnect to work it started an hour ago. One kernel per machine, across the whole fleet, and a session on one box can watch and drive work on another.

The kernel is written in Elixir, and if you have never used Elixir, the one-paragraph version is this: it runs on the BEAM, the virtual machine built for telephone switches, where a system is thousands of tiny isolated processes that each crash and restart independently, supervised in trees, with distribution between machines built into the runtime rather than bolted on. Replace “phone calls” with “agent jobs” and it is the same problem: huge concurrency, partial failure as the normal case, and no tolerance for one stuck task taking down the switch.

kernel · machine Asupervised jobskernel · machine Bsupervised jobskernel · machine Csupervised jobsdistribution built into the runtimeagentagentagentan agent on B can watch jobs on C; a wedged job never locks the kernel

In practice that buys things a subprocess-per-command harness cannot: each cell runs in its own BEAM process, so a blocking call never delays other jobs or the server; a stuck job can be inspected from outside and killed without collateral; and the workspace restarts restore state from a checkpoint. The kernel lives in packages/mcp.