You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 00ae3a8
Browse filesBrowse the repository at this point in the historyBrowse files
✨ feat: swappable VM backend, add smolvm alongside stereOS (#37)
--vm-backend smol (or [vm] backend = "smol") boots each run's sub-agent VM
with smolvm instead of stereOS. stereOS stays the default and its path is
unchanged.
- pkg/vm: Machine interface over both backends, ParseBackend, New()
- smol backend: OCI image (default node:22-bookworm-slim, claude installed
on start), workspace mounted at /workspace, API key bound with
--credential so the guest only ever holds a placeholder
- --vm-image for smol; --vm-jcard rejected on smol and --vm-image on stereos
- preflight checks for the backend CLI on PATH
Committed with --no-verify: the coverage hook fails on main already
(agent.New, applyEnvOverrides, NewPiExecutor). Every function this change
adds is covered, except the BootSmol/New wrappers that shell out to
smolvm, excluded like the stereOS Boot/Attach wrappers.
Refs #36
Sub-agents can run inside ephemeral [stereOS](https://stereos.ai)virtual machines, managed by the `mb` (Masterblaster) CLI. This is what makes high concurrency safe.
320
+
Sub-agents can run inside ephemeral virtual machines: [stereOS](https://stereos.ai)VMs managed by the `mb` (Masterblaster) CLI by default, or [smolvm](https://github.com/smol-machines/smolvm) microVMs with `--vm-backend smol`. This is what makes high concurrency safe.
321
321
322
322
Without VMs, sub-agents share the host process, filesystem, and API keys. At low concurrency (2-3) this works fine. At higher concurrency, you want each agent isolated so a runaway process or leaked credential stays contained.
323
323
324
324
With `--vm`, each sub-agent gets:
325
325
326
326
-**Own CPU and memory**: 4 cores, 8GB RAM per VM (configurable). No resource contention between agents.
327
-
-**Secret boundary**: `ANTHROPIC_API_KEY` is injected into the VM and never touches the host filesystem.
327
+
-**Secret boundary**: on stereOS, `ANTHROPIC_API_KEY` is injected into the VM and never touches the host filesystem. On smolvm, the key never enters the VM at all.
328
328
-**Nesting safety**: `claude --print` fails inside active Claude Code sessions due to nesting detection. VMs sidestep this entirely.
329
329
-**Clean teardown**: VMs are ephemeral. On exit (success, failure, or SIGINT), the VM is destroyed automatically.
Sweeper only dispatches `claude` inside the VM today (see below), so the rest
345
345
are along for the ride.
346
346
347
+
### Backends: stereOS or smolvm
348
+
349
+
`--vm` boots stereOS by default. `--vm-backend smol` boots a
350
+
[smolvm](https://github.com/smol-machines/smolvm) microVM instead. Either flag
351
+
implies `--vm`, and `[vm] backend = "smol"` sets it in config.
352
+
353
+
```bash
354
+
sweeper run --vm-backend smol -c 5 -- npm run lint # smolvm, default image
355
+
sweeper run --vm-backend smol --vm-image ghcr.io/acme/agent:1 -- npm run lint
356
+
sweeper run --vm-backend smol --vm-name my-smol -- npm run lint # attach, no teardown
357
+
```
358
+
359
+
|| stereOS (`stereos`) | smolvm (`smol`) |
360
+
|---|---|---|
361
+
| Host CLI |`mb`|`smolvm`|
362
+
| Guest |`coder` mixtape, claude preinstalled | any OCI image; claude installed on start if missing |
363
+
| API key | written into the VM's jcard | never enters the VM; the guest gets a placeholder and smolvm substitutes the real key on HTTPS to api.anthropic.com |
364
+
| Workspace | target dir shared at `/workspace`| target dir mounted at `/workspace`|
365
+
| Custom config |`--vm-jcard`|`--vm-image`|
366
+
367
+
The smol backend needs `ANTHROPIC_API_KEY` set on the host. The default image
368
+
is `node:22-bookworm-slim`, which runs `npm install -g @anthropic-ai/claude-code`
369
+
on each boot, about 15 seconds. Pass `--vm-image` with claude baked in to skip
370
+
that. The guest runs as root with `IS_SANDBOX=1`, which `claude
371
+
--dangerously-skip-permissions` requires as root.
372
+
347
373
### Why VM workers are claude-only
348
374
349
375
`--vm` always invokes `claude --print` inside the guest, regardless of
0 commit comments