Back to blog posts

12 min

How gVisor vs Firecracker compare for sandboxing AI agent workloads

Compare gVisor vs Firecracker on isolation, startup, I/O overhead, KVM needs, and Kubernetes fit to choose the right sandbox runtime.

Nicolas LecomteNico is a founder of Blaxel, who usually writes about AI, agentics, and the future of AI runtimes.

Agent code from large language models (LLMs) needs isolation from the host. gVisor and Firecracker draw the boundary differently. gVisor runs a user-space kernel that intercepts system calls and needs no Kernel-based Virtual Machine (KVM) access. That lets it run in ordinary VMs as a drop-in runtime.

Firecracker boots each workload as a microVM with its own guest kernel. Hardware enforces its boundary, but it typically needs KVM-capable hosts.

The choice comes down to two questions: where you can run, and how much isolation you need. Each runtime has the edge on one of them.

Key takeaways

  • Isolation strength rises from containers to gVisor to Firecracker microVMs, which add a hardware-virtualized guest kernel per workload.
  • gVisor trades syscall, network, and file I/O latency for isolation. CPU-bound code sees little overhead.
  • gVisor's default systrap platform needs no KVM. Firecracker needs /dev/kvm on bare metal or nested virtualization, except in its EC2-only Nitro Sandbox mode.
  • Use Firecracker for LLM-generated, multi-tenant code. Use gVisor for Kubernetes-first, semi-trusted workloads on hosts without KVM.

gVisor vs Firecracker at a glance

This table compares gVisor and Firecracker on the axes infrastructure teams check first:

DimensiongVisorFirecracker
Isolation boundaryUser-space application kernel (the Sentry) between workload and host kernelHardware-virtualized guest with its own kernel per microVM
Syscall compatibility292 of 352 syscalls on amd64, full or partialFull Linux guest kernel
StartupThroughput (HotCloud 2019): 2.3 containers/sec vs 2.6 for runcLatency: guest init in 125ms or less, per the specification
I/O and syscall overheadMinimal for CPU-bound code, degraded for I/O-intensive and network-intensive workI/O crosses emulated virtio devices, which add overhead and support token-bucket rate limits
Memory overheadSmall and mostly fixed5 MiB or less per virtual machine monitor, per the specification
Snapshotsrunsc checkpoint and runsc restoreFull snapshots generally available since v1.13.0, diff snapshots in developer preview
GPU supportnvproxy for NVIDIA T4, A100, A10G, L4, and H100No released GPU or device passthrough support documented
Ops complexityDrop-in container runtime, runs in ordinary VMsNeeds /dev/kvm (or EC2 Nitro Enclaves since v1.18.0), the jailer, and a host fleet. firecracker-containerd archived November 10, 2026
Production usersApp Engine standard, Cloud Run first generation, and GKE SandboxAWS Lambda, Fargate, and Bedrock AgentCore Runtime

What is gVisor?

gVisor is an application kernel that runs in user space between a container and the host Linux kernel. It ships as runsc, an Open Container Initiative (OCI) runtime that plugs into Docker, containerd, and Kubernetes.

Its main component, the Sentry, implements system calls, signals, memory management, and threading itself. It does not pass application syscalls through to the host. The Sentry catches syscalls through a platform, gVisor's term for its interception mechanism.

Systrap is the default and traps calls with seccomp's SECCOMP_RET_TRAP. KVM is the faster platform on bare metal. The ptrace platform remains in the codebase, but gVisor no longer supports it.

File access goes through the Gofer, a separate host process that serves the container filesystem. With directfs, the default mode, the Gofer donates file descriptors so the sandbox opens files directly. gVisor's 2019 security analysis counted at most 68 host syscalls for the Sentry, against about 350 in Linux 5.3.11.

What is Firecracker?

Firecracker is a virtual machine monitor (VMM) that AWS built for Lambda and now also uses for Fargate. It uses KVM to boot each workload as a microVM with its own guest Linux kernel.

The device model is small. Firecracker emulates virtio-net and virtio-block devices, a serial console, and a partial keyboard controller. It also offers virtio-vsock and virtio-balloon devices. Guest syscalls hit the guest kernel, and device I/O crosses into the VMM through those emulated devices.

Firecracker wraps the VMM process in further controls. It installs its own seccomp filters. A separate jailer binary sets up cgroups, namespaces, and a chroot. It then drops privileges and launches Firecracker unprivileged.

Where gVisor and Firecracker differ

In a ranking of Firecracker microVMs, gVisor, and containers, gVisor sits in the middle. It's stronger than a standard container and weaker than hardware virtualization. On the other axes, the results are more evenly split.

Isolation boundary and attack surface

Firecracker wins this axis. A standard container shares the host kernel, so one kernel bug can expose every tenant on a node. A microVM vs Docker comparison covers the container side in depth.

gVisor puts the Sentry in front of the host kernel. Application syscalls land in code that implements Linux behavior itself. The Sentry runs under a seccomp filter in an empty mount namespace. It cannot create host sockets unless an operator turns on host networking. With directfs, it opens files only through mount-point descriptors the Gofer donates. The Sentry reduces the host-kernel interface, though some host configurations add escape paths.

Firecracker puts the first barrier in hardware. The guest kernel is separate from the host kernel. The jailer and seccomp also constrain the VMM process.

AI-generated code is untrusted third-party code, so isolation strength outweighs raw speed.

Security track record

Official records document high-severity vulnerabilities in both projects.

Each record was current as of November 16, 2026:

  • gVisor CVE-2026-96812: The GitHub advisory record rates it High. Through the Gofer, an attacker with image deployment privileges could gain root code execution on the host. The attack required CUSE (character devices in user space) to be turned on.
  • gVisor CVE-2026-95702: A use-after-free in the virtual filesystem allowed code execution in the Sentry before release 20260831.0. The National Vulnerability Database entry says the Sentry stayed confined by host seccomp and namespaces.
  • Firecracker CVE-2026-122192: The project advisory rates it High. It lets a guest root user read or modify Firecracker process memory. It affects snapshot restores using the File backend with a balloon or virtio-mem device, versions 0.23.0 through 1.16.1.
  • Firecracker CVE-2026-5747: An out-of-bounds write existed in the opt-in virtio-pci transport. Host code execution required extra preconditions such as a custom guest kernel.
  • Firecracker CVE-2026-1386: A jailer symlink flaw let a local host user overwrite host files. It needed host access.

The CUSE, PCI, and snapshot-restore issues had configuration-specific preconditions. CVE-2026-95702 affected gVisor on all platforms under standard container privileges. Whether an advisory applies to you depends on its preconditions and your configuration. Pin patched releases, such as 1.16.2 or 1.17.0 for CVE-2026-122192.

Startup time and memory footprint

Firecracker publishes measured bounds. gVisor's performance guide charts startup and memory but does not print startup values. The figures below measure different things, so they do not directly rank the two.

Key empirical measurements highlight the operational trade-offs between gVisor and Firecracker in startup times and memory utilization:

  • The peer-reviewed HotCloud 2019 study measured startup throughput, a different metric from Firecracker's boot latency. It recorded 2.3 containers per second for runsc versus 2.6 for runc.
  • Firecracker's specification puts VMM process start at 8 CPU ms. Wall-clock time spans 6ms to 60ms, typically near 12ms. The 125ms bound holds only with the serial console off and a minimal kernel and root filesystem.
  • The NSDI 2020 paper tested Firecracker v0.20.0 on an EC2 m5d.metal host. With 50 microVMs launching concurrently, pre-configured Firecracker reached a 99th percentile of 146ms. In separate serial boot tests, a network interface added around 20ms. The paper reports up to 150 microVMs created per second per host, with VMM memory overhead around 3 MB.
  • gVisor's performance guide attributes most measured start time to Docker itself. It describes the sandbox's memory overhead as small and mostly fixed.

Firecracker achieves predictable sub-150ms microVM initialization with minimal baseline overhead, whereas gVisor offers a lightweight footprint whose startup latency is primarily governed by the container runtime harness.

Syscall, network, and file I/O overhead

Infrastructure teams should expect syscall overhead with gVisor and emulated-device overhead with Firecracker.

Comparing I/O patterns reveals distinct performance trade-offs across both runtimes:

  • gVisor's production guide says I/O-intensive and network-intensive workloads see degraded performance. CPU-bound workloads see minimal or no overhead. The gVisor authors ran the performance guide's benchmarks on ptrace unless otherwise specified, so check the platform behind each figure.
  • The clearest per-call numbers come from a 2021 gVisor blog post about Ant Group. On a Xeon E5-2650 v2, getpid took 62ns natively. It took 830ns on runsc-KVM and 6,249ns on runsc-ptrace. The systrap release post calls systrap faster than ptrace and shows the gain only in charts. Directfs made stat(2) more than twice as fast by skipping Gofer round trips.
  • Firecracker's specification lists up to 14.5 Gbps of guest network throughput using at most 80% of a host core. It lists 0.06ms of added network latency on average. Storage reaches 1 GiB/s using up to 70% of a core. All three figures carry an "integration test pending" mark.

gVisor incurs measurable microsecond-level syscall translation latency while delivering native CPU performance, whereas Firecracker provides near-native syscall speeds bounded primarily by virtio-emulated device throughput.

Compatibility, KVM requirements, and Kubernetes

gVisor runs on more kinds of hosts. Systrap needs no virtualization support, so it works inside an ordinary cloud VM. The gVisor platform guide calls nested virtualization slow and not recommended for production.

Infrastructure support and orchestration integration differ significantly across cloud environments:

  • On Kubernetes, gVisor ships containerd-shim-runsc-v1. A RuntimeClass maps pods to the runsc handler. GKE Sandbox packages the same setup as a node pool option.
  • Outside its EC2-only Nitro Sandbox mode, Firecracker requires read/write access to /dev/kvm. It therefore needs bare metal or a VM with nested virtualization. Firecracker maintainers have said they do not support nested setups.
  • AWS now supports nested virtualization on virtual instances such as C8i, M8i, and R8i.
  • Google Compute Engine allows only the KVM hypervisor inside its VMs. Google also warns of slowdowns of 10% or more for CPU-bound nested work.
  • firecracker-containerd is now archived. Its README cites Nitro Sandboxes, Firecracker's EC2-only mode, as an alternative. Kata Containers is another Kubernetes option for running Firecracker.

While gVisor integrates seamlessly into standard Kubernetes clusters without hardware virtualization dependencies, Firecracker mandates bare-metal hosts or specific nested virtualization configurations.

Snapshots, GPU support, and operational complexity

State preservation, hardware acceleration, and ongoing management overhead are critical factors when evaluating long-term operational feasibility for agent sandbox fleets.

Key operational considerations for snapshot management, GPU passthrough, and resource reclamation include:

  • On Linux 5.18 and later guests, Firecracker's VMGenID (virtual machine generation ID) reseeds the kernel random generator on resume. The snapshot documentation warns that unique identifiers, cached random numbers, and tokens still repeat across clones. Restored clones also keep the same IP addresses.
  • gVisor checkpoint/restore runs through runsc commands or Docker's checkpoint commands. It does not support rootless or remote direct memory access (RDMA) sandboxes. A November 2026 gVisor checkpoint post reports a 2 GiB sandbox restoring in 939ms from disk. From page cache, the same restore took 71ms.
  • gVisor's nvproxy, which proxies NVIDIA GPU driver calls, supports driver versions that track GKE. Firecracker added a PCI transport for virtio in v1.13. Virtual Function I/O (VFIO) passthrough exists only in unreleased development branches.
  • gVisor returns memory released through madvise to the host immediately. Firecracker's balloon device depends on a guest driver, and a compromised guest can refuse to cooperate. Firecracker snapshot formats also change between releases: v1.16.2 snapshots do not load on 1.16.0 or 1.16.1.

While gVisor offers straightforward container-native checkpointing and GPU proxying via nvproxy, Firecracker provides robust VM-level state restoration at the cost of stricter hypervisor constraints and manual host management.

Where Kata Containers fits

Kata Containers is an OCI runtime that runs each pod in a lightweight VM with its own guest kernel. Kata's hypervisor list covers QEMU, Cloud Hypervisor, Firecracker, Dragonball, and StratoVirt. Kata names QEMU as the best-supported hypervisor for NVIDIA GPUs.

Kata on Firecracker gives up features: it lacks filesystem sharing, device hotplug, and VFIO. It supports the Container Runtime Interface only partially. Google also offers Kata as a managed option: the GKE Sandbox microVM type uses Kata with Cloud Hypervisor.

Which should you choose for agent workloads?

For AI agents that execute LLM-generated code, choose Firecracker microVMs. The code is arbitrary by design, and a hardware boundary does not rely on one user-space kernel being bug-free. The cost is KVM-capable hosts and the operations work they require.

Common workloads and rules of thumb follow:

  • AI agent code execution: Each task runs code nobody reviewed, so Firecracker's hardware boundary fits.
  • Multi-tenant SaaS: Firecracker gives each workload a separate guest kernel, which keeps tenants apart.
  • Continuous integration and delivery: Use Firecracker for untrusted pull requests and gVisor for internal pipelines on Kubernetes.
  • Serverless functions: Both work in production. Lambda and Fargate run on Firecracker, and Cloud Run first generation runs on gVisor.
  • Choose gVisor if: You lack KVM access, run Kubernetes-first, execute semi-trusted code, and have a small operations budget.
  • Choose Firecracker if: You run arbitrary or LLM-generated code or need multi-tenant isolation, and your hosts expose KVM.

gVisor on ordinary cloud VMs is adequate for early development on your own code.

Where Baseten Sandboxes fit

Running Firecracker yourself means owning KVM-capable hosts, jailer setup, guest kernels, version upgrades, and every security advisory.

As the infrastructure foundation for autonomous agents, Baseten Sandboxes isolate each workload in its own Firecracker microVM and kernel. New sandboxes come up in under a second.

After about 15 seconds without network activity, a sandbox moves to standby and stops accruing compute charges. Resuming from standby takes under 25ms and keeps the filesystem, memory, and running processes intact.

Network controls sit above the microVM boundary. Per-workload outbound traffic control, in public preview, limits what agent code can reach. A managed proxy, also in public preview, injects secrets into outbound requests, so the sandbox never sees raw credentials. Data that must outlive a sandbox belongs in Volumes, since standby is not durable storage.

Baseten Sandboxes run CPU workloads only. For untrusted GPU code, Kata on QEMU keeps a VM boundary per pod. gVisor's nvproxy runs without KVM, but its user-space boundary is weaker.

FAQs about gVisor vs Firecracker

Is gVisor or Firecracker more secure?

Firecracker gives the stronger boundary. Agent code runs against a separate guest kernel, so reaching the host takes a VMM or KVM bug. gVisor intercepts syscalls in the Sentry, which runs under a strict host seccomp filter. The Sentry layer makes gVisor harder to escape than a standard container. gVisor still sits closer to the host kernel than hardware virtualization does. Both projects had high-severity advisories in 2026, so patch cadence matters for either.

Can Firecracker run inside a cloud VM?

Yes, when the VM exposes nested virtualization. Firecracker needs /dev/kvm except in its Nitro Sandbox mode on EC2, and its maintainers do not support nested setups. AWS documents nested virtualization on instances such as C8i, M8i, and R8i. Google Compute Engine supports it, excluding E2, Arm, and most AMD machine types, and warns of slower CPU-bound work. gVisor's systrap platform needs no virtualization, so it runs inside VMs without that setup.

How does gVisor compare with Kata Containers?

Both plug into Kubernetes as container runtimes. gVisor implements Linux behavior in a user-space kernel and runs without KVM. Kata starts a lightweight VM per pod with its own guest kernel. It can use QEMU, Cloud Hypervisor, Firecracker, or another supported hypervisor. Kata therefore needs virtualization access, as Firecracker does. GKE Sandbox now offers both, with a gVisor type and a microVM type built on Kata and Cloud Hypervisor.

Related articles

Guides

A developer's guide to the OpenAI Agents SDK

Learn how to build with the OpenAI Agents SDK in Python, from tools, handoffs, guardrails, and sessions to tracing, costs, and sandboxed code execution.

10 min read