Named, strongly isolated Linux sandboxes for AI agents — each a real KVM virtual machine supervised by a host daemon,
with a Docker-shaped CLI (run, exec, shell, ps, logs, suspend, start, fork, snapshot, disk, net,
secret, and more; agentvm help lists every verb). The semantics underneath are VM semantics: hardware isolation,
copy-on-write disk layers, real suspend/resume including RAM, host-directory mounts, and a host-side egress filter that
holds the API keys the sandbox never sees.
There is no QEMU in the runtime path: the VMM, the block format, the snapshot format and the FUSE server behind the shares are all in this repository (PLAN.md explains why, and what it costs).
- Linux with KVM (
/dev/kvm), x86-64, GCC 13+ or Clang 17+, CMake ≥ 3.31, OpenSSL 3. - A kernel toolchain to build the guest kernel:
bc,flex,bison,libelf-dev,libssl-dev,make,gcc. mmdebstrapfor building the guest image, and network access to a Devuan mirror over HTTP.- For the network features:
CAP_NET_ADMIN(taps and nftables). The sandboxes themselves run without it; what needs it isrun --net tap, anddoctorsays so when it is missing. Either run as root, or grant the capability to the three binaries once withsudo agentvm setup --grant-net-admin(asetcap; re-run it after every install, since a replaced binary loses the capability).packaging/README.mdhas the details.
cmake --preset release # or: --preset debug
cmake --build --preset release -j8
ctest --preset release # unit + CLI tests; guest tests skip without KVM or artifacts
sudo cmake --install build/release --prefix /usr/local # CLI, daemon, monitor and the two guest binariesA supervisor is optional but recommended: packaging/agentvmd.service is a user unit, and
packaging/README.md explains what needs privilege and what does not.
Then, once per machine:
agentvm doctor # what this host can and cannot do, named
agentvm setup # state tree, instance id, per-install MITM CA (idempotent, safe to re-run)
agentvm kernel build 6.12.117 # the guest kernel (cached; ~5 minutes)
agentvm image build devuan # the guest rootfs (~2 minutes, then ~200 MiB on disk)
agentvm run devuan 'uname -r && echo hello'agentvm setup is the only step that writes trust material: it creates a per-install CA under
~/.agentvm/ca/ (D2 — never baked into images, never in version control). Re-running it leaves existing material alone;
agentvm setup --check writes nothing at all.
| document | what it answers |
|---|---|
PLAN.md |
the design, the decision log (D1–D22) and the milestone table |
docs/acceptance.md |
where the project actually stands — each milestone's criterion checked against the code |
docs/perf.md |
measured numbers: boot, resume, share round trips, the 100k-file bench |
docs/guest-kernel.md |
why the guest kernel is ours, and what is in it |
docs/agent-protocol.md |
the guest agent's wire contract (control channel and exec) |
docs/adr/ |
the seven decisions taken while building: VMM backend, exec, avm-co, snapshots, shares, idle policy, HTTP/1.1-only in the MITM proxy |
A sandbox with a link reaches nothing until a rule says so. Rules are target[:port[:protocol[:mode]]]:
agentvm run --net tap --allow api.example.com devuan 'curl -sS https://api.example.com/health'
agentvm net allow NAME 'api.example.com:443:https:mitm' # terminate TLS, inject the key from `agentvm secret`
agentvm net allow NAME 'example.com:80:http:mitm' # plain HTTP, rewritten by Host
agentvm net allow NAME 'git.example.com:22' # ssh: relayed, not inspected
agentvm net allow NAME '203.0.113.7:5432:other' # an address instead of a name
agentvm net policy NAME # what each rule will actually dotarget is a name, a *.example.com wildcard, an IPv4 address or an IPv4 block. The protocol (https, http,
other) constrains the mode (passthrough, mitm, raw) — a rule that could not work is refused where it is
written, rather than failing on the first connection. Every named port is redirected to one listener, which reads the
real port from conntrack and the name from the TLS SNI or the HTTP Host:; a raw rule is relayed from the host, so
SSH and databases reach the internet too. The policy may be edited on a running sandbox (net allow/net deny) and is
recorded in the sandbox's spec. Only TCP is relayed (UDP is DNS only, so QUIC is refused), and agentvm help net has
the full table.
Everything lives under one directory (~/.agentvm by default, --home or AGENTVM_HOME to move it): kernels/,
images/, sandboxes/ (one directory per sandbox: immutable spec, mutable state, layer), snapshots/, ca/,
secrets.json, agentvmd.sock. Removing the directory is a clean uninstall; nothing is installed outside it except the
binaries.
agentvm fsck reconciles the records with reality after a crash (it is also what removes a record whose monitor is
gone), and agentvm ps marks a live record with a dead pid as running? rather than hiding it.
M0–M9 are delivered, with two M9 items stated plainly: HTTP/2 upstream was decided against (ADR-007, the MITM
proxy speaks HTTP/1.1 and says so in ALPN) and egress record/replay for tests was not built. Everything else is in the
tree: the VMM, registry and daemon, CoW layers and fork, host shares, suspend/resume (including fork --with-memory
of a suspended sandbox), the egress filter with per-connection dispatch (nftables + authoritative DNS filter + one L7
listener that relays, splices by SNI or terminates TLS) with secret injection and redaction, image import,
virtio-rng, idle suspend/pause, packaging and the guest-kernel documentation.
What is left is one unbuilt M9 item plus verification, and docs/acceptance.md is the list that matters — it says what
is met, what is partly met and what is a gap, with the reason. In short: the <500 ms bare-metal boot target has
never been measured on bare metal (there is none on the machine this was built on), cgroup enforcement needs a
delegated cgroup tree, and the M8 demo has not been run with a real API key.