| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
MicroVM sandboxes for AI agents, built on cocoon: a fast-boot guest stack, an in-guest product daemon, a per-node control plane with warm pools, and a Go SDK. Warm claims are sub-millisecond; a pool miss clones from a golden snapshot in tens of milliseconds; cold boot is ~200ms on bare metal.
SDK (Go) sandboxd (per node) guest microVM
sandbox.New() ── HTTP ─► claim: warm pool / golden clone Cloud Hypervisor
sb.Exec/Files/… ─ HTTP upgrade ─► byte relay ── vsock ──► silkd :2048
memberlist mesh: warm-count gossip,
MOVED-style redirect to the owning node
Cloud Hypervisor serves both network lanes. net=none has no NIC and uses vsock-only I/O (hardened default); net=egress attaches a bridge/CNI NIC.
Documentation: cocoonstack.github.io/sandbox (deployment, clusters, HTTP API, Go + Python SDK references, the MCP server, the OpenAI Agents SDK and LangChain adapters, silkd protocol, performance) — source in docs/.
make help # this list
make lint test # Rust: boot/init + silkd (fmt --check, clippy -D warnings, tests)
make go-lint # Go: sandboxd + sdk/go + e2e + mcp, GOOS linux AND darwin
make go-test # Go: go test -race across the Go modules
make sandboxd # build dist/sandboxd
make boot # kernel + initramfs artifact image (docker)
# KERNEL_MIRROR=… if kernel.org tarball paths 404 locally
make silkd-image # silkd release binary in a scratch carrier image
make images # base + python images against the local boot + silkd imagesThe parent workspace's go.work excludes these modules; the Makefile forces GOWORK=off so local runs match CI. silkd's integration tests spawn real processes — run them in a Linux container too (docker run rust:1 … cargo test) before touching platform-sensitive paths; macOS green alone has hidden Linux-only breakage before.
scripts/sandboxd-e2e.sh drives the real stack on a node with cocoon and a silkd-baked template image: golden build → warm pool → claim tiers → the full v2-verb smoke (files/session/find/replace/watch/git/pty) → reap → restart reconcile.
TEMPLATE=rt:24.04 scripts/sandboxd-e2e.sh
# BRIDGE=br0 adds an egress pool and the egress lane-detect check; a plain
# `ip link add br0 type bridge` with no uplink is enough (NIC, not network).
# SANDBOXD_BIN/DEMO_BIN/SMOKE_BIN point at prebuilt binaries for nodes
# without a Go toolchain.
# VOLUME_IMAGE=/absolute/dataset.img enables the volumes proof (ro sharing
# + rw claim/release); the image contains volume-e2e.txt. Prebuilt runs
# also set VOLUME_SMOKE_BIN.On a fresh repo run build-boot first — images build FROM the boot artifact.
cloud-hypervisor → vmlinux (PVH ELF, everything =y, no decompress stage) → uncompressed ~1.5MB cpio: /init = sandbox-init (static Rust) → resolve virtio-blk serials via sysfs (2ms poll, no udev) → mount EROFS layers → overlayfs + ext4 COW → switch_root → exec /sbin/init (systemd, trimmed; cocoon-agent + silkd start at sysinit)
Boot contract (cmdline keys consumed by sandbox-init):
| cmdline key | meaning |
|---|---|
| cocoon.layers=a,b,… | EROFS layer disks resolved from virtio-blk serials, lowerdir order |
| cocoon.cow=x | writable ext4 COW disk (same resolution rules) |
| cocoon.timeout=10 | per-disk wait budget, seconds |
| cocoon.hostname=h | set via sethostname(2) before handoff |
| ip=addr::gw:mask:host:ethN:off[:dns0[:dns1]] | cocoon CNI static config: persisted as a MAC-matched networkd unit in the new root (not applied in the initramfs); absent → the image's DHCP fallback covers the NIC |
| sandbox.init=/path | handoff target, default /sbin/init |
| sandbox.debug=1 | fatal errors drop to /bin/sh (debug initramfs) instead of poweroff |
| sandbox.trace=1 | emit one pre-handoff line with per-phase µs timings |
boot=cocoon-overlay is ignored. Everything cocoon passes today keeps working — images built here boot with an unmodified cocoon.
The server stack — sandboxd, silkd, the boot chain, the OS images, and the MCP server — is licensed under AGPL-3.0. The client SDKs (sdk/go, sdk/python, sdk/openai, sdk/langchain) are licensed under Apache-2.0 (see the LICENSE file in each directory), so embedding a client in a proprietary agent stack carries no copyleft obligation.
| Back | FazBrowse Home | New Git URL |