# Kagex > Give every coding agent its own instant Linux microVM—locally, offline-safe, for $0. Spin up disposable Ubuntu 24.04 microVMs in milliseconds on macOS, Windows, and Linux. Isolate writes, lock down egress, keep secrets out of guest RAM, and wire your coding agent in one command. Every coding prompt runs inside an isolated Ubuntu 24.04 microVM backed by Apple Virtualization.framework (macOS 14+ Apple Silicon) or Firecracker KVM (native Linux hosts and Windows 10/11 via WSL2). Workspace changes remain sandboxed until inspected with diff and applied with automatic backups and instant undo, egress traffic passes an allowlist firewall, and stored credentials are swapped on the host so secrets never enter guest RAM. MIT licensed, $0 cost. ## Quick Install ### macOS (Apple Silicon) ```bash git clone https://github.com/CodewithEvilxd/kagex && cd kagex make images build ./_out/bin/sandboxd install --artifacts _out ``` ### Windows 10/11 (PowerShell, non-admin WSL2 KVM) ```powershell git clone https://github.com/CodewithEvilxd/kagex; cd kagex powershell -ExecutionPolicy Bypass -File .\scripts\setup-windows.ps1 ``` ### Linux (KVM) ```bash git clone https://github.com/CodewithEvilxd/kagex && cd kagex make images build sudo ./_out/bin/sandboxd install --artifacts _out ``` ## Connect an Agent (MCP) ```bash ./_out/bin/sandboxctl mcp install antigravity --project ~/code/app ./_out/bin/sandboxctl mcp install cursor --project ~/code/app ./_out/bin/sandboxctl mcp install claude --project ~/code/app ./_out/bin/sandboxctl mcp install codex --project ~/code/app ``` ## Interactive & Machine-Readable Entry Points - [Home Studio](https://kagex.vercel.app): Interactive CLI VM simulator, Runtime Matrix & Speed Lab - [MK-IV 3D Hypervisor Cutaway](https://kagex.vercel.app/cutaway): Interactive Three.js microVM blueprint & CLI - [Key Points, Comparisons & Glossary](https://kagex.vercel.app/topics): 80 verified key points, 24 glossary entities & matrix - [Engineering Guides Hub (31 Guides)](https://kagex.vercel.app/guides): Complete multi-OS, security, MCP & comparison docs - [Complete Markdown Context Specification](https://kagex.vercel.app/llms-full.txt) - [Structured AI Knowledge JSON Feed](https://kagex.vercel.app/ai-data.json) ## Guides Index (31 Guides) - [Run Google Antigravity Coding Agents Inside Isolated Kagex MicroVMs](https://kagex.vercel.app/guides/antigravity-mcp-sandbox): Wire Google Antigravity IDE and agents to disposable Ubuntu 24.04 microVMs in one command with sandboxctl mcp install antigravity, complete with rules/AGENTS.md and SKILL.md. - [Isolate Cursor AI Agent Commands Inside Local Linux MicroVMs](https://kagex.vercel.app/guides/cursor-mcp-sandbox): Configure Cursor with Kagex MCP (.cursor/mcp.json + .cursor/rules/sandbox.mdc) so Composer and Agent runs execute inside ~32 ms isolated Ubuntu 24.04 microVMs. - [Claude Code Local MicroVM Sandboxing with Kagex MCP & SKILL.md](https://kagex.vercel.app/guides/claude-code-mcp-sandbox): Give Claude Code full Ubuntu 24.04 root inside a zero-trust local microVM using sandboxctl mcp install claude, .claude/skills/sandbox/SKILL.md, and ghost secret injection. - [OpenAI Codex CLI Sandboxing via Kagex MicroVMs & AGENTS.md](https://kagex.vercel.app/guides/codex-cli-mcp-sandbox): Wire OpenAI Codex CLI to Kagex local microVMs via ~/.codex/config.toml and AGENTS.md for isolated Linux execution, snapshot checkpoints, and safe 3-way merges. - [Complete Guide to Kagex's 11 MCP Sandbox Tools](https://kagex.vercel.app/guides/mcp-tools-reference-guide): Detailed architecture and usage reference for all 11 Kagex MCP tools: sandbox_exec, read_file, write_file, diff, apply, pull, snapshot, network, port, status, and destroy. - [Build Parallel AI Agent Harnesses with the Kagex Go SDK (pkg/client)](https://kagex.vercel.app/guides/custom-go-agent-harness-sdk): Use github.com/codewithevilxd/kagex/pkg/client in Go to launch microVMs, clone parallel forks with c.Fork, run candidate patches concurrently, and inspect winning diffs. - [Stream AI Sandbox Commands from Python over Unix Socket & SSE](https://kagex.vercel.app/guides/python-sse-agent-sandbox): Integrate Python AI workflows (LangGraph, CrewAI, AutoGen, custom eval loops) with Kagex over AF_UNIX or TCP using stdlib http.client and real-time Server-Sent Events. - [Rootless Apple Silicon MicroVMs with Virtualization.framework & APFS CoW](https://kagex.vercel.app/guides/macos-apple-silicon-virtualization-framework): How Kagex runs Ubuntu 24.04 microVMs natively on macOS 14+ Apple Silicon with Virtualization.framework, APFS clonefile CoW disks, and gVisor userspace networking — zero root or Docker runtime required. - [Linux KVM & Firecracker v1.12.1 MicroVMs with Per-VM Netns & nftables](https://kagex.vercel.app/guides/linux-firecracker-kvm-microvms): Deploy Firecracker v1.12.1 microVMs on amd64 and arm64 Linux hosts with isolated network namespaces, nftables egress filtering, and FICLONE copy-on-write disks. - [Windows 10 & 11 Local Firecracker MicroVMs via Non-Admin WSL2 KVM](https://kagex.vercel.app/guides/windows-11-wsl2-kvm-agent-sandbox): Run real Firecracker KVM Ubuntu 24.04 microVMs on Windows 10/11 Home, Pro, or Enterprise with native .exe CLI/MCP binaries, one-command PowerShell setup, and automatic WSL2 path translation. - [Run Nested dockerd & Testcontainers Safely Inside MicroVM Sandboxes](https://kagex.vercel.app/guides/nested-docker-inside-microvm): Execute Docker builds, Compose stacks, and integration containers safely inside an isolated Kagex Ubuntu 24.04 microVM without granting AI agents access to your host Docker socket. - [How sandbox-agent Works: PID 1 Linux Guest Agent & gRPC over AF_VSOCK](https://kagex.vercel.app/guides/virtio-vsock-grpc-guest-agent): Inside Kagex's initramfs PID 1 guest runtime (internal/guest): AF_VSOCK port 52 transport, zombie process reaping, PTY streams, frame spooling, and traversal-safe file RPCs. - [Ghost Secrets Vault: Keeping API Keys & Tokens Out of AI Sandbox RAM](https://kagex.vercel.app/guides/ghost-secrets-vault-mitm-proxy): Protect GitHub PATs, OpenAI/Anthropic keys, and deploy tokens even when an AI agent has root inside its microVM using synthetic placeholders (sbxph_...) and host ECDSA P-256 TLS swapping. - [Default-Deny Allowlist Egress Firewall & DNS Rebinding Defense](https://kagex.vercel.app/guides/allowlist-egress-firewall-dns-rebinding): How Kagex blocks LAN lateral movement, AWS/GCP IMDS metadata endpoints (169.254.169.254), loopback probes, and DNS rebinding attacks for autonomous coding agents. - [Reversible AI Edits: One-Way Host Sync, Diff, 3-Way Apply, and Undo](https://kagex.vercel.app/guides/one-way-workspace-sync-3way-apply-undo): Never wake up to a wiped git repo: Kagex mirrors workspaces host-to-VM one way over vsock, previews diffs, runs safe git merge-file 3-way applies, and archives backups for one-command undo. - [Scoped Git Credentials & Branch Push Guardrails for Autonomous Agents](https://kagex.vercel.app/guides/git-smart-http-branch-push-guard): Strip raw .git/config tokens on sync and enforce repository + branch glob policies (like sbx/*) on autonomous git pushes via Kagex's smart-HTTP Git proxy. - [Why Kagex Bans virtio-fs & Uses safefs Symlink-Fenced Host Writes](https://kagex.vercel.app/guides/safefs-zero-shared-folders-isolation): Learn why Kagex disables shared host folders (no virtio-fs or 9p mounts), validates every tar path against symlink escapes in guest/files, and fences cleanup via internal/safefs. - [Zero-Trust Architecture for Autonomous Coding Agents in 2026](https://kagex.vercel.app/guides/zero-trust-ai-code-execution): End-to-end threat model covering prompt injection, dependency supply-chain scripts (postinstall), credential harvesting, LAN reconnaissance, and destructive shell commands inside AI coding sandboxes. - [Kagex vs E2B: Local Zero-Cost MicroVMs vs Cloud Sandboxes](https://kagex.vercel.app/guides/kagex-vs-e2b-local-microvm): Compare Kagex vs E2B for AI coding agents: latency (20–50 ms local warm pool), cost ($0 vs cloud VM billing), privacy (source never leaves your laptop), and Ghost Secrets. - [MicroVMs vs Docker Containers: Why Containers Fall Short for AI Agents](https://kagex.vercel.app/guides/kagex-vs-docker-for-ai-agents): Technical comparison of Kagex microVMs vs Docker containers for autonomous coding agents: kernel boundary vs shared host kernel, virtio-fs vs one-way sync, and nested dockerd. - [Kagex vs Cloud Dev Environments (Modal, Daytona, Codespaces)](https://kagex.vercel.app/guides/kagex-vs-modal-daytona-devpod): When to use Kagex sub-second local microVMs vs remote cloud sandboxes like Modal, Daytona, or GitHub Codespaces for daily AI agent workflows. - [The Economics of Local AI Agent Sandboxing: Saving 100% on Cloud VM Bills](https://kagex.vercel.app/guides/local-microvm-vs-cloud-sandbox-cost): Calculate how parallel autonomous agents, SWE-bench loops, and CI reproducers burn cloud VM spend vs running unlimited microVMs locally at $0 on Kagex. - [Inside Kagex's 20–50 ms Warm Pool Engine & Instant Agent Attachment](https://kagex.vercel.app/guides/32ms-warm-pool-microvm-boot): How internal/service/pool.go pre-warms Ubuntu 24.04 microVMs in standby memory so attaching workspaces and executing commands finishes in 20–50 milliseconds. - [Parallel MicroVM Forking: Race Multiple AI Code Fixes Side-by-Side](https://kagex.vercel.app/guides/parallel-agent-forking-workflows): Clone a running sandbox state N times concurrently in ~0.8 s per fork using sandboxctl fork or pkg/client Fork() to evaluate competing AI hypotheses safely. - [Golden Snapshots, Pause-to-Disk & Sub-Second Agent Restores](https://kagex.vercel.app/guides/cow-golden-snapshots-pause-resume): Cache dependency builds in golden snapshots (0.5–0.6 s create), pause running sessions cleanly on daemon shutdown, and recover gracefully across restarts. - [Safely Preview AI-Built Web Apps via Loopback Port Forwarding](https://kagex.vercel.app/guides/local-port-forwarding-sandbox-previews): Expose Vite, Next.js, Flask, or API dev servers running inside an isolated Kagex microVM strictly on host 127.0.0.1 using sandboxctl port or MCP sandbox_port. - [Ubuntu 24.04 Rootfs, Toolchains & Auto-Template Resolution](https://kagex.vercel.app/guides/multi-language-ubuntu-24-04-sandbox-templates): Inside Kagex's Ubuntu 24.04 ext4 rootfs builder (infra/image/Dockerfile & build-rootfs.sh), automatic language detection (template=auto), and sha256-pinned kernels. - [Observe AI MicroVMs with OpenTelemetry, Prometheus & Grafana](https://kagex.vercel.app/guides/opentelemetry-prometheus-grafana-microvm-metrics): Inspect per-phase microVM latency waterfalls via sandboxctl trace, export OTLP spans to Jaeger/Tempo, and monitor fleet metrics with Kagex's ready-to-run Grafana dashboard. - [sandboxctl & sandboxd Complete CLI Reference for Developers](https://kagex.vercel.app/guides/sandboxctl-cli-complete-reference): Master every sandboxctl and sandboxd command: create, exec, shell, cp, diff, apply, pull, undo, snapshot, fork, net, secret, events, trace, gc, doctor, and mcp install. - [sandboxd HTTP/JSON + SSE REST API & OpenAPI 3 Contract Guide](https://kagex.vercel.app/guides/sandboxd-http-rest-sse-openapi-guide): Automate Kagex from TypeScript, Rust, Ruby, or curl using the documented REST & Server-Sent Events contract in docs/openapi.yaml (GET /v1/openapi.yaml). - [Inside the Kagex MK-IV 3D Hypervisor Architecture & Interactive Simulator](https://kagex.vercel.app/guides/3d-mk4-hypervisor-cutaway-architecture): Explore Kagex's 10 hardware & control-plane subsystems visually in 3D (/cutaway): Agent MCP Mux, sandboxd Rotor, virtio-vsock Coil, nested dockerd, CoW Blade Tray, Ghost Key Enclave, Firewall Shutter, and Diff/Undo Stack. ## Source & Contracts - [GitHub Repository](https://github.com/CodewithEvilxd/kagex) - [OpenAPI Contract](https://github.com/CodewithEvilxd/kagex/blob/main/docs/openapi.yaml) - [Architecture](https://github.com/CodewithEvilxd/kagex/blob/main/docs/ARCHITECTURE.md) - [Security Policy](https://github.com/CodewithEvilxd/kagex/blob/main/docs/SECURITY.md) - [Maintainer Portfolio](https://nishantgaurav.site) - [Contact](mailto:codewithevilxd@gmail.com)