Comparison
gVisor vs Kata Containers for AI Agent Sandboxes
A user-space kernel or a guest kernel in a lightweight VM: what each one puts between agent code and your host, and when each is the right call.
Checked against each project's documentation on
gVisor
An application kernel written in Go that runs in user space. Its OCI runtime, runsc, handles a container's system calls itself instead of passing them to the host kernel.
Kata Containers
A container runtime that starts each pod inside a lightweight virtual machine with its own Linux guest kernel, using a hypervisor such as QEMU, Cloud Hypervisor or Firecracker.
The short answer
Both exist because a plain container shares the host kernel with whatever runs inside it, and an AI agent executing code it wrote is exactly the kind of workload you should not trust with that kernel. They fix it in different places. gVisor moves the kernel into a user-space process per sandbox, so agent code talks to gVisor's Sentry rather than to Linux. Kata Containers gives each sandbox a real guest kernel and puts a hardware virtualization boundary between that kernel and the host.
Pick gVisor when you cannot get KVM (most cloud VMs without nested virtualization), when density and a process-like memory footprint matter, and when your agents' tools run on its implemented syscall surface. Pick Kata when you want a hardware boundary per sandbox, full Linux compatibility for whatever the agent installs, GPU passthrough or confidential computing, and you control bare metal or nested-virtualization hosts.
Side by side
| gVisor | Kata Containers | |
|---|---|---|
| Isolation boundary | A per-sandbox application kernel (the Sentry) in user space. Application system calls are served by the Sentry, not passed through to the host. | A lightweight VM per pod with its own Linux guest kernel, behind hardware virtualization (KVM). |
| What touches the host kernel | The Sentry's own host system calls, restricted by seccomp. File access outside the sandbox goes through a separate Gofer process. | The hypervisor process and its virtual devices. The guest kernel never runs on the host kernel directly. |
| Host requirements | Any recent Linux host. The default systrap platform needs no virtualization support, so it runs inside ordinary cloud VMs. | KVM on the host: bare metal, or a cloud VM with nested virtualization enabled. |
| Linux compatibility | Most, not all, system calls and /proc and /sys files are implemented. Check gVisor's compatibility list for the tools your agents run. | A real Linux guest kernel, so software that runs on Linux generally runs. What the guest kernel was built with still sets the limits. |
| Resource model | Process-like: memory and threads grow and shrink with the workload, with no fixed guest memory to size. | VM-like: each sandbox has vCPUs and memory assigned to its guest, on top of a guest kernel per sandbox. |
| How you run it | runsc, an OCI runtime: Docker, containerd, CRI-O and Kubernetes through a RuntimeClass. | The containerd shim (containerd-shim-kata-v2) for containerd and CRI-O, and Kubernetes through a RuntimeClass. |
| Choices underneath | Platforms: systrap (the default since mid-2023), KVM, and the older ptrace. | Hypervisors: QEMU, Cloud Hypervisor, Firecracker, Dragonball and StratoVirt. |
| GPUs | NVIDIA GPUs through nvproxy, for the drivers and devices its GPU guide lists. | GPU passthrough on QEMU runtimes (the kata-qemu-nvidia-gpu-* runtimes). The other hypervisors do not support GPUs. |
| Confidential computing | Not applicable: gVisor is not a VM, so it cannot be an Intel TDX or AMD SEV-SNP guest. | Intel TDX and AMD SEV-SNP on QEMU, and the base of the Confidential Containers project. |
| Snapshot and restore | runsc checkpoint and restore are documented, so a sandbox's state can be saved and brought back. | Depends on the hypervisor and Kata version; check Kata's documentation before you design around it. |
| Start-up | No guest kernel to boot; the sandbox starts as host processes. | Boots a guest kernel per sandbox; how long that takes depends on the hypervisor, guest kernel and image. |
| Where you meet it managed | GKE Sandbox on Google Kubernetes Engine. | OpenShift sandboxed containers, and Confidential Containers. |
| Licence | Apache 2.0, originally created by Google; a CNCF sandbox project. | Apache 2.0, formed in 2017 from Intel Clear Containers and Hyper runV. |
Where each one draws the boundary
In a plain container, agent code makes system calls straight into the host kernel, and namespaces and cgroups only change what those calls can see. A single kernel bug reachable from inside the container is a way out. Both runtimes exist to take that kernel off the table.
gVisor intercepts each system call and answers it in the Sentry, a kernel written in Go that runs as an ordinary user-space process. The Sentry makes a much smaller set of host calls of its own and runs under a seccomp filter, and it cannot open files itself: the Gofer process does that on its behalf. The attacker's path now runs through gVisor's code before it reaches Linux.
Kata runs the container inside a virtual machine. Agent code makes system calls into a guest Linux kernel that belongs to that sandbox alone, and getting out means breaking the guest kernel and then the hypervisor beneath it. That is the same boundary cloud providers use to separate tenants, which is why it is the usual answer when several customers' agents share one host.
What your hosts decide for you
The most practical difference is hardware. Kata needs KVM, so it runs on bare metal or on cloud instances with nested virtualization switched on. gVisor's default platform, systrap, works on any Linux host, including the ordinary cloud VMs most teams already run Kubernetes on. gVisor's own platform guide notes that systrap often performs better than its KVM platform inside a nested VM.
If you are deploying onto managed Kubernetes nodes you do not control, that alone may settle it. If you run your own metal, both are open to you and the decision moves to compatibility and threat model.
What agents actually run into
Agents are not a fixed application you can test once. They pip install, compile, open sockets, spawn browsers and run whatever the model decided to try. With gVisor, the question is whether all of that stays on the system calls and /proc and /sys files it implements; most common tooling does, but an unusual syscall, a kernel feature or a device a tool expects can fail in ways a plain Linux host would not. Run your agents' real task suite under runsc before you commit.
With Kata, the agent gets a real Linux kernel, so compatibility problems are rare and usually come from the guest kernel's configuration rather than missing kernel features. The cost is a guest kernel and assigned memory per sandbox, which lowers how many sandboxes fit on a host.
GPU work splits them further. gVisor reaches NVIDIA GPUs through nvproxy, which forwards driver calls rather than passing a device through, for the drivers its GPU guide lists. Kata's GPU support is on QEMU runtimes with passthrough; Firecracker and Cloud Hypervisor runtimes do not support GPUs.
Start-up and wake latency
gVisor starts a sandbox as a set of host processes, with no guest kernel to boot. Kata boots a guest kernel for each sandbox, so its start-up depends on the hypervisor you pick, how small the guest kernel and image are, and how storage is attached. Kata with Firecracker, for example, needs a block device as the VM's backing store, which means setting up containerd's devmapper snapshotter.
We do not quote start-up numbers here, because published figures rarely match a real agent workload on your hosts. Measure the time from sandbox create to the first command returning, for a cold start and for a sandbox restored from a checkpoint or snapshot, using your own images, the tools your agents call first and the node types you actually run. Run each case many times and compare the slowest runs as well as the typical ones: that tail is what an agent waiting on a sandbox feels.
If you would rather not run either yourself
Managed options exist on both sides. GKE Sandbox runs pods under gVisor on Google Kubernetes Engine, and OpenShift sandboxed containers are built on Kata. Agent-specific platforms take a third route and give each agent a Firecracker micro-VM directly: Maritime, for example, runs machines as Firecracker micro-VMs billed per second that sleep when idle and wake in about a second. Check each provider's documentation for its current isolation model, regions and pricing before you choose.
Which one to choose
Choose gVisor when
- Your nodes are cloud VMs without nested virtualization, or managed Kubernetes nodes you cannot change.
- You want many small sandboxes per host, with memory that follows the workload.
- Your agents' tools pass a test run under runsc, and your threat model accepts a user-space kernel as the boundary.
- You want to checkpoint and restore sandboxes with documented runsc commands.
Choose Kata Containers when
- Several tenants' agents share a host and you want a hardware virtualization boundary between them.
- Agents install and run arbitrary software and you need full Linux compatibility.
- You need GPU passthrough, or Intel TDX or AMD SEV-SNP confidential computing.
- You control bare metal or nested-virtualization hosts and can size a guest per sandbox.
Questions people ask
Is gVisor a virtual machine?
No. gVisor's own documentation describes it as an application kernel that runs in user space, neither a syscall filter nor a VM. It can use KVM as one of its platforms, but it does not boot a guest Linux kernel.
Is Kata Containers the same as Firecracker?
No. Firecracker is a hypervisor (a virtual machine monitor). Kata Containers is a container runtime that can use Firecracker, QEMU, Cloud Hypervisor, Dragonball or StratoVirt to run each pod's VM.
Which is more secure for untrusted AI-generated code?
Kata puts a hardware virtualization boundary and a separate guest kernel between agent code and the host, which is the stronger boundary in most threat models. gVisor greatly shrinks how much of the host kernel agent code can reach, without needing KVM. Either is a large step up from a plain container; the choice depends on your hosts and who shares them.
Can I run both in one Kubernetes cluster?
Yes. Both register as runtimes behind a Kubernetes RuntimeClass, so different workloads can ask for different runtimes, provided the nodes they land on have each runtime installed.
Which one starts faster?
gVisor has no guest kernel to boot, while Kata boots one per sandbox, but the real figure depends on your hypervisor, images and hosts. Measure create-to-first-command on your own nodes, cold and from a snapshot, before you decide on start-up time.
Further reading on Wake Latency Report
- Runtime Isolation Options for Untrusted AI Agents Ranked by Blast Radius
- Firecracker Micro-VM Isolation vs Container Sandboxing for AI Agents
- Kernel-Level Sandboxing for AI-Written Code Execution
- Why Multi-Tenant Agent Clouds Need Hardware Virtualization Boundaries Not Namespace Tricks
- Why the Host Kernel Is Your Biggest Agent Security Liability and How Micro-VMs Fix It
Sources
- What is gVisor? (gVisor documentation)
- gVisor platform guide
- gVisor application compatibility
- gVisor GPU support
- gVisor checkpoint/restore
- Kata Containers
- Kata Containers architecture
- Kata Containers hypervisors
- Configure Kata Containers to use Firecracker
- GKE Sandbox (Google Cloud documentation)
- Confidential Containers