Gondolin Documentation
AI agents are generating code that runs immediately and increasingly without human review. That code often calls external APIs, which means it needs credentials and network access. Sandboxing the compute isn't enough as you need to control network egress and protect secrets from exfiltration. You also want to be able to tightly control the file system, for convenience of the agent and to control persistence.
Gondolin gives you that. Lightweight micro-VMs (libkrun where available, QEMU otherwise) boot in under a second on your Mac or Linux machine. The network stack and virtual filesystem run on the host, in a small daemon, and are programmable from JavaScript, giving you complete control over what the sandbox can access and what secrets it can use.
This documentation helps you get started with it. We also welcome your feedback as this is an early project and we are eager to learn more about how you want to use it.
A little appetizer:
npx @earendil-works/gondolin bashOr programmatically:
import { VM, createHttpHooks } from "@earendil-works/gondolin";
const { httpHooks, env } = createHttpHooks({
allowedHosts: ["api.github.com"],
secrets: {
GITHUB_TOKEN: {
hosts: ["api.github.com"],
value: process.env.GITHUB_TOKEN!,
},
},
});
const vm = await VM.create({ httpHooks, env });
// NOTE:
// - `vm.exec("...")` runs via `/bin/sh -lc "..."` (shell features work)
// - `vm.exec([cmd, ...argv])` executes `cmd` directly (no shell); a bare name
// is looked up in the guest's `$PATH`
const cmd = `
curl -sS -f \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user
`;
// You can pass a string to `vm.exec(...)` as shorthand for `/bin/sh -lc "..."`.
const result = await vm.exec(cmd);
console.log("exitCode:", result.exitCode);
console.log("stdout:\n", result.stdout);
console.log("stderr:\n", result.stderr);
await vm.close();Where to Start
- Installation: requirements and installing the npm package or the static CLI
- Quick Start: a first shell, a first SDK program
- Workloads and Lifecycle: how to use VMs for agent workloads
- Upgrading: what changed between releases and what to do about it
Guides
- Running Commands: creating VMs,
vm.exec(), streaming, shells and sessions - Network Access: what the guest can reach, host allowlists, DNS, mapped TCP, TLS
- HTTP Hooks and Policies: declarative policy, policies that run in the daemon, and JavaScript hooks
- Secrets: placeholder-based secret injection
- Files and Mounts: mounting host directories, in-memory and programmable filesystems,
vm.fs - Persistence and Snapshots: rootfs modes, disk size and checkpoints
- Ingress: expose guest HTTP servers on the host
- SSH: SSH into the guest, and SSH from the guest to allowed upstreams
- Images: selecting, downloading and managing guest images
- Building Custom Images: build images with your own packages and init scripts
- Remote Machines: run the VM on another machine while policy stays local
- Debugging and Troubleshooting: debug logging and common errors
Reference
- CLI: every command and option
- SDK:
VMOptions, theVMAPI and the other exports - Environment Variables: every variable Gondolin reads
- VM Backends: krun and QEMU, how the default is chosen, feature parity
Design & Internals
- Architecture: components, processes and data flow
- Security Design: threat model, guarantees and safe operating envelope
- Network Stack: how traffic is classified, mediated and enforced
- QEMU Backend: QEMU integration and macOS/Linux parity
- Limitations: current limitations and missing features