Skip to content
Dashboard

gVisor vs. microVMs: Which should you use for agent isolation?

Content Engineer

Choose gVisor when your agent's tested toolchain fits its application kernel and you want to retain container tooling. Favor a microVM when you require a separate Linux guest kernel, especially for changing toolchains. Neither architecture is universally safer or faster; evaluate your workload and runtime controls.

An analytics agent writing Python and a coding agent working across unfamiliar repositories both execute untrusted code. The analytics agent uses a fixed package set that you can test before release. Each dependency or build tool the coding agent installs can introduce a new compatibility requirement.

Copy link to headingHow do gVisor and microVMs handle system calls?

gVisor puts an application kernel between sandboxed code and the host operating system. Its Sentry intercepts and implements system calls and maintains the sandbox's process state. For example, the Sentry can answer a request for a process ID from its own state. It uses restricted host calls when needed, rather than forwarding the application's calls directly to the host kernel.

Firecracker is a virtual machine monitor (VMM) for microVMs with a reduced device model. Its KVM backend uses Linux's Kernel-based Virtual Machine (KVM) to run a separate Linux guest. The guest kernel handles application system calls, with the VMM and KVM forming part of the boundary to the host.

The table compares gVisor with Firecracker's KVM-backed microVMs.

Decision

gVisor

Firecracker microVM with KVM

Application system calls

Sentry implements Linux syscall behavior

Linux guest kernel handles calls

Compatibility to evaluate

gVisor's implemented Linux syscall interface

Guest kernel configuration and available tools

Container integration

runsc integrates with Docker and Kubernetes

Container tools can run inside a suitable guest

Host responsibilities

Runtime configuration, resource limits, and external network policy

VMM confinement, guest setup, and host network policy

Useful starting workload

Fixed package set you can test before release

Changing toolchain that needs a separate Linux guest

The fixed Python runner can also run in a microVM, and a changing coding workload may work with gVisor. Use these categories as starting points and let your dependencies determine the compatibility requirements.

Copy link to headingHow do the security boundaries differ?

With gVisor, the Sentry handles the application's Linux requests while its own host access remains restricted. Flaws in an application-facing Linux kernel interface therefore don't automatically expose the same path through gVisor. The Sentry's implementation and the controls around it still need security review and updates.

In a microVM, the application interacts with a guest Linux kernel. If malicious code compromises that kernel, it can take over the guest, but reaching the host still requires crossing the virtualization boundary. The VMM and its exposed interfaces are part of that remaining boundary.

For either architecture, decide which programs may share an environment. Putting two customers' jobs in one workspace exposes them to shared files and permissions without requiring a host escape. The sandbox allocation policy must match the separation your product promises.

Copy link to headingWhich fits a fixed runner or a changing toolchain?

For the analytics agent, test the complete Python environment under gVisor. Include package imports and native extensions, then run representative generated scripts against realistic files. Starting the interpreter alone tells you little about the libraries those scripts will use.

If those tests pass and you already operate containers, gVisor's runsc integration lets you keep that tooling while adding the application-kernel boundary.

gVisor implements a subset of the Linux syscall interface. An unsupported syscall doesn't necessarily mean a runtime will fail, because libraries can detect available calls and use alternatives. Diagnose the failing operation before rejecting gVisor or changing a working dependency set.

The coding agent needs a different test set because installing a repository's dependencies is part of its job. Exercise package installation, compilation, test runners, and subprocesses across the repositories you expect it to handle. Decide whether an unsupported operation can produce a useful failure or whether the product promises that the agent can continue with newly installed tools.

If the agent runs Docker, distinguish using runsc to launch a sandboxed container from running a Docker engine inside gVisor. gVisor supports the latter with additional runtime configuration and networking and storage constraints. Include the agent's image builds and container networking in your tests before deciding that it needs a microVM.

Favor a microVM when you need a separate Linux kernel for those behaviors. Test the guest environment with the agent's actual tools.

The guest image may lack required packages, and its kernel configuration may not support every tool. Record repository failures so you can distinguish missing software from incompatibilities caused by the isolation environment.

Keep representative repositories as regression cases. When a new dependency fails, rerun the previous toolchain on the same sandbox configuration. That gives you a baseline for deciding whether to pin the dependency, adjust the execution environment, or change the supported workload before accepting the update.

Copy link to headingWhat must you operate around each boundary?

With gVisor, resource limits rely on host cgroups, and network policy needs enforcement outside the sandbox. Review mapped files and runtime configuration alongside the code that starts each job. Check every execution path for unintended access, even when the main runner is narrowly configured.

Self-hosting Firecracker requires guest and host configuration. Its KVM-backed design uses host resources for networking and disks. In production, constrain the Firecracker process with the jailer or equally restrictive controls. Firecracker doesn't filter network traffic, so apply network policy on the host.

Copy link to headingWhen should you choose Vercel Sandbox for an agent?

Vercel Sandbox fits the coding-agent case when you want a separate Linux guest kernel and a service that operates the underlying microVM infrastructure. Each sandbox runs in a Firecracker microVM with its own filesystem and network. You can place the agent process inside it, or keep the agent in your application and send only the generated programs for execution.

For an agent that works across repositories, prepare its build tools in a custom Sandbox image. Give each workspace the files it needs, then let the agent run its install and test commands within that environment. Use the same image and workspace setup for evaluation and production.

If tests need containerized services, run Docker inside the sandbox so its daemon belongs to the agent's guest. For HTTPS requests that the firewall terminates, configure those containers to trust the sandbox's proxy CA certificate.

Set the Sandbox firewall policy for each job phase. The default is allow-all; deny-all blocks outbound traffic and DNS.

Credential brokering can inject secrets into outbound API requests without exposing the raw values to the program. The agent can still exercise those credentials' permissions, so restrict them to the operations the job needs.

Notion runs developer- and agent-authored Workers in separate Sandbox microVMs, with network policies and credential injection outside execution.

Copy link to headingHow should you evaluate compatibility and performance?

Build the evaluation around a complete agent job. For the analytics runner, measure input loading through result export. For the coding agent, include dependency installation and the test command that determines whether its change worked. Record failures alongside elapsed time so incomplete runs cannot pass.

Use the same inputs and resource budgets where possible, and record the host and runtime configuration for each result. Separate environment preparation from command execution. If you compare a prepared image with an environment that installs packages on demand, label those conditions; otherwise the result mixes packaging choices with isolation overhead.

gVisor's additional software layers and Sentry memory contribute runtime overhead. That fact alone cannot rank it against a microVM for your agent. Measure the workload on the deployment you intend to operate, including concurrent jobs, before setting a performance target. Neither an architecture label nor an old benchmark establishes which will finish your jobs sooner.

Also test what happens after interruption. If you depend on snapshots, confirm what the implementation restores. File restoration and resuming running processes are different requirements, and snapshot scope varies by implementation. Use an acceptance test to confirm that the agent can resume its intended work with the restored state, including any setup it must repeat.

Copy link to headingWhat does neither isolation boundary guarantee?

Neither gVisor nor a microVM automatically denies outbound network access or enforces business permissions. Code can use the files and connections you permit. Give the analytics runner only its selected input data, and configure the coding agent's dependency access deliberately. Keep authorization for external actions in the application and services that grant those actions.

Running a separate guest kernel changes the isolation design without guaranteeing that the complete deployment is more secure. Host configuration and the permissions around execution remain relevant for both approaches. Approve the architecture together with its operational controls, then rerun the workload evaluation when the toolchain or runtime changes.

Copy link to headingFrequently asked questions

Copy link to headingIs a microVM always more secure than gVisor?

No. Security depends on the complete deployment, including the implementation, host configuration, and access granted to the workload. Compare how a microVM's guest-kernel boundary and gVisor's Sentry implementation of application system calls address your threat model.

Copy link to headingWhy can gVisor use KVM?

gVisor's KVM platform uses hardware virtualization extensions while retaining its application-kernel and process model. It doesn't boot a conventional Linux guest with a virtualized hardware layer. gVisor also supports the systrap platform, which uses seccomp traps to intercept system calls.

Copy link to headingDoes an agent that runs Docker need a microVM?

No. gVisor can run a Docker engine with additional runtime configuration, subject to networking and storage constraints. Test the agent's builds and container operations against those constraints before choosing gVisor or a microVM.

Copy link to headingHow should you choose when an agent toolchain changes?

Treat each toolchain change as a reason to repeat compatibility tests. Fixed package sets make it practical to validate gVisor before release; an agent that installs unfamiliar tools gives you a stronger reason to evaluate a separate Linux guest kernel. Test installation and actual job completion on either approach before accepting the new toolchain.

More Sandbox articles

Ready to deploy?