Blog / 31 October 2026

Deep dive · 31 October 2026 · 8 min read

Self-hosted AI sandbox options: running an E2B alternative yourself

You can run an AI code sandbox on your own hardware in 2026 in roughly five ways: E2B's own runtime on a KVM host, a fork of Daytona's archived AGPL-3.0 code, a local microVM runtime such as microsandbox or Docker Sandboxes, a Kubernetes cluster running agent-sandbox over gVisor or Kata, or a local product like kosa8. They differ most in where they run, what the isolation boundary is, and how much you have to operate.

self-hosted e2b alternativee2b alternative localdaytona alternativeon-prem ai sandboxself-hosted code interpreter sandbox

01What does self-hosting an AI sandbox actually mean?

A cloud code-interpreter sandbox gives an agent a fresh machine to run code in, reached over an API, on someone else's servers. Self-hosting moves that machine onto hardware you control: a laptop, a server in your rack, or a cluster in your own cloud account. Teams usually want this for one of three reasons: data that may not leave the network, an air-gapped or regulated environment, or cost and latency at high volume.

Three questions sort the options better than any feature list. Where does it run: one developer's machine, one Linux host, or a cluster? What is the boundary: a shared host kernel with a syscall filter, a user-space kernel like gVisor, or a hardware-virtualized microVM with its own kernel? And what do you have to operate: a single binary, a compose file, or a control plane, image builder and object storage? The sections below answer those three for each option, using each project's own documentation.

  • E2B Embed: one Linux host with KVM; Firecracker microVMs; you run the whole stack.
  • Daytona (archived repo): wherever you deploy your fork; AGPL-3.0; no upstream fixes.
  • microsandbox: a developer machine on Linux, macOS or Windows; local microVMs; a library or CLI.
  • Kubernetes agent-sandbox: your cluster; gVisor or Kata via RuntimeClass; cluster operations.
  • Docker Sandboxes: a developer machine; microVMs with a host-side proxy; the sbx CLI.
  • kosa8: an Apple-chip Mac or x86-64 Linux machine; microVMs with their own kernel; one install.

02Can you self-host E2B?

Yes. E2B publishes its backend as E2B Runtime, Apache-2.0 licensed, and describes it as the same code that serves its public cloud, dedicated enterprise deployments and a single-machine package called Embed. The runtime gives each sandbox one Firecracker microVM in its own cgroup and network namespace, with a per-sandbox nftables egress firewall and domain allow and deny lists that inspect SNI and the Host header. Sandboxes boot from snapshots, can be paused and resumed, and a running sandbox can be forked.

Embed is the whole stack on one Linux host with KVM, started from a compose file. E2B also ships it as Terraform for GCP, AWS and Azure and as a Kubernetes manifest, and says Embed is one machine by design; for multi-node production it offers a dedicated deployment inside your own cloud account. The ops burden is real but bounded: a KVM-capable Linux host, the compose stack, templates you build, and upgrades you apply. Because Firecracker needs KVM, Embed does not run natively on a Mac.

03What happened to self-hosting Daytona?

Daytona's public repository now opens with a notice: as of June 2026 core development moved to a private codebase, and the repository will receive no further updates, fixes or releases. It stays public and usable under its licence, which is the GNU Affero General Public License version 3, as is and without support. That is why searches for a Daytona alternative now often mean either a community fork of that AGPL-3.0 code or a different project.

Running a fork is a legitimate choice, but it changes the ops picture. Security fixes become your job or your fork's maintainers' job. And AGPL-3.0 has a network clause: if you modify the program and let users interact with it over a network, you must offer them the corresponding source. Check that with whoever handles licensing before building a product on it. Daytona's hosted service continues separately; this section is only about the self-hosted code.

04Local microVM runtimes: microsandbox and Docker Sandboxes

microsandbox, Apache-2.0 licensed, runs untrusted workloads in local microVMs on Linux, macOS and Windows. It runs standard OCI images, can fork live sandboxes and save and restore running state, and is embeddable: its README says you can spawn VMs from your own code with no setup server and no long-running daemon. It also lists secrets that never enter the VM. The ops burden is close to that of a library, and the boundary is a hardware-virtualized machine per sandbox.

Docker Sandboxes run coding agents through the sbx CLI, either locally or on Docker-managed cloud compute. Docker's architecture page describes each local sandbox as a microVM with hypervisor isolation and its own Docker daemon, image cache and packages. All outbound TCP goes through a proxy on the host, and the agent sees a sentinel in place of the real API credential, which the proxy swaps in after the request leaves the VM. Docker states the CLI and local sandboxes are free to use, including commercially, while central admin policy management needs a separate paid subscription.

Both suit a developer or a small team on their own machines. Neither is a multi-tenant server you point a fleet of agents at, which is where E2B Embed or Kubernetes fit better.

05Self-hosting on Kubernetes: agent-sandbox with gVisor or Kata

If you already run Kubernetes, agent-sandbox is a Kubernetes SIG Apps project, Apache-2.0 licensed, that adds a Sandbox custom resource and controller for long-running, stateful, single-pod workloads with a stable identity and persistent storage. Extensions add SandboxTemplate, SandboxClaim and SandboxWarmPool for pre-warmed pools. Its README is explicit about scope: it is a sandbox orchestrator and delegates isolation to a runtime such as gVisor or Kata Containers, chosen through RuntimeClass.

So the boundary depends on the runtime you install. gVisor describes itself as an application kernel, neither a syscall filter nor a VM in the everyday sense, that gives many of a VM's security benefits with a smaller footprint. Kata Containers builds lightweight virtual machines that plug into the container ecosystem, using hardware virtualization as a second layer of defence, so its nodes need virtualization support. The ops burden is the highest here: a cluster, node pools configured for the runtime, network policy for egress, and the controller itself. The pay-off is scale and the scheduling, quotas and audit you already have.

06How to choose a self-hosted sandbox

Start from where the agents run today, not from the feature table. If one developer runs a coding agent on a laptop, a local microVM runtime is the shortest path. If a service runs thousands of short code-interpreter calls, a server-side stack such as E2B Embed or a Kubernetes cluster is built for that. Then check the boundary and the secrets model, because those decide what a hijacked agent can reach.

Mixing is normal. A team can give developers a local sandbox for coding agents and run a server-side stack for the product's code-interpreter feature, as long as both answer the questions below the same way.

  • Does it run on the hardware you have: macOS, Linux with KVM, Windows, or a cluster?
  • Is the boundary a separate kernel per sandbox, or a shared host kernel with filtering?
  • Is the network closed by default, and is egress decided outside the sandbox?
  • Do API keys stay outside the sandbox, or are they copied in as environment variables?
  • Is the code maintained upstream, and does its licence fit how you will ship it?
  • Who will apply security updates, and how much of a control plane are you taking on?

Takeaways

  1. Self-hosted AI sandbox options split by where they run: one developer machine, one Linux host, or a Kubernetes cluster.
  2. E2B Runtime is Apache-2.0 licensed and its Embed package runs the full stack on one Linux host with KVM.
  3. Daytona's public repository is archived as of June 2026; the AGPL-3.0 code can be forked but gets no upstream fixes.
  4. microsandbox and Docker Sandboxes run microVMs locally; agent-sandbox orchestrates gVisor or Kata pods on Kubernetes.
  5. Compare the isolation boundary, whether keys stay outside the sandbox, and who operates and patches it.

Where kosa8 fits

kosa8 is one of the local options. It runs on Apple-chip Macs and x86-64 Linux, with Windows through WSL2 in preview, and supports air-gapped installs. Each agent gets a microVM with its own kernel that sees one workspace folder, the network is closed except for an allow-list you write, and API keys stay on the host behind an egress broker, so there are 0 real keys inside the sandbox. It exposes a Docker-compatible API, so tools that drive Docker can use it through DOCKER_HOST. It is not a managed cloud service or a Kubernetes operator; for a multi-node fleet, the server-side options above are built for that.

Check yourself · +100 XP

In Kubernetes agent-sandbox, what provides the actual isolation boundary for each sandbox?

Questions people ask

Is there a self-hosted E2B alternative that runs on a Mac?

E2B Embed needs a Linux host with KVM, so it does not run natively on macOS. microsandbox documents macOS support, and kosa8 runs on Apple-chip Macs.

Can I still self-host Daytona?

The public repository is archived and remains available under AGPL-3.0, so you can run or fork it, but it receives no further updates or fixes from Daytona. Check the AGPL network clause before offering a modified version as a service.

What is the lowest-effort on-prem AI sandbox?

For a single machine, a local microVM runtime installed as one binary or CLI. For a shared service, E2B Embed on one KVM host is a compose stack; Kubernetes agent-sandbox fits teams that already operate clusters.

Sources

  1. E2B Runtime — E2B on GitHub
  2. daytonaio/daytona (archived repository notice) — Daytona on GitHub
  3. Daytona LICENSE (GNU AGPL v3) at v0.190.0 — Daytona on GitHub
  4. microsandbox — microsandbox on GitHub
  5. Docker Sandboxes — Docker Docs
  6. Docker Sandboxes architecture — Docker Docs
  7. Agent Sandbox — Kubernetes SIGs on GitHub
  8. What is gVisor? — gVisor docs
  9. Kata Containers — Kata Containers
  10. Local AI agent sandbox — kosa8 guides
  11. Docker vs microVM for AI agents — kosa8 guides
  12. How to build a self-hosted code interpreter for your LLM — kosa8 guides

Written by the kosa8 team. Every kosa8 command was checked against the CLI, and every claim about another product links to that product's own documentation. Spotted a mistake? Tell us.

Try it on your own machine

Give your next agent its own sealed machine.

One line installs kosa8 on your own machine. Every feature, plans from $29 a month.