Agent Sandboxesagentsandboxes.org
Head-to-head

bubblewrap vs nsjail

Answer in brief

Choose bubblewrap for lightweight process sandboxing on Linux where you control the policy and do not need a kernel boundary; choose nsjail for running untrusted programs or network services under tight syscall, memory and CPU limits on Linux. bubblewrap uses Linux namespaces isolation and is open source; nsjail uses Namespaces + seccomp isolation and is open source.

By the Agent Sandboxes editors · Updated

Key differences between bubblewrap and nsjail

  • Isolation: bubblewrap uses Linux namespaces; nsjail uses Namespaces + seccomp.
  • Licence: bubblewrap is LGPL-2.1; nsjail is Apache-2.0.

What they have in common

  • Both are open-source projects you run yourself.
  • Both use OS-level sandboxing.
  • Both are open source.
  • Both can be self-hosted.
  • Both list CLI.

bubblewrap vs nsjail at a glance

Attributebubblewrapnsjail
What it isThe unprivileged Linux namespace sandboxer behind Flatpak and Anthropic's sandbox runtime; you assemble the policy from command-line flags.A Linux process isolation tool combining namespaces, cgroups, rlimits and Kafel seccomp-bpf policies, with listen, once and rerun modes for untrusted programs.
TypeOpen-source projectOpen-source project
IsolationUnprivileged Linux user, mount, PID, network, IPC and UTS namespaces with a tmpfs root, PR_SET_NO_NEW_PRIVS and optional seccomp filters; the caller defines the policyLinux UTS, mount, PID, IPC, network, user, cgroup and time namespaces, cgroup v1/v2 limits, rlimits, chroot/pivot_root and seccomp-bpf syscall filters written in Kafel
Open sourceYes (LGPL-2.1)Yes (Apache-2.0)
Self-host / BYOCYes / NoYes / No
SDKsCLICLI
Cold start (vendor claim)Not documentedNot documented
Max sessionNot documentedConfigurable CPU-time rlimit and wall-clock time limit per jail
PersistenceNone; the sandbox starts from an empty tmpfs root that is cleaned up when the last process exits, with host paths bind-mounted as you chooseNone built in; filesystem is whatever you chroot or bind-mount
Snapshots / pauseNo / NoNo / No
GPUNot documentedNot documented
NetworkingHost network by default; --unshare-net gives a network namespace with loopback onlyNetwork namespace with isolated or cloned Ethernet interfaces, MACVLAN (requires root) or userland networking via pasta
PricingFree and open sourceFree and open source
Free tierFree to self-hostFree to self-host
ComplianceNot documentedNot documented
RegionsNot documentedNot documented
Company headquartersNot documentedNot documented
Good fit forLightweight process sandboxing on Linux where you control the policy and do not need a kernel boundaryRunning untrusted programs or network services under tight syscall, memory and CPU limits on Linux

Verified November 14, 2026 from each provider’s documentation. Cold-start figures are vendor claims, not our measurements.

Which should you choose?

Reasons to choose bubblewrap

  • You want a tiny, well-understood tool to confine a coding agent's shell on a Linux machine
  • You need unprivileged sandboxing without a daemon, container runtime or hypervisor
  • You are building a local agent sandbox and want the same primitive Anthropic uses on Linux

Reasons to choose nsjail

  • You need per-execution CPU, memory, process and syscall limits for an untrusted code runner
  • You want a single binary with a protobuf config rather than a container runtime
  • You run network-facing untrusted services and want inetd-style listen mode

Trade-offs to check first

  • bubblewrap: Isolation uses host-kernel namespaces and optional seccomp filters; there is no separate guest kernel
  • bubblewrap: No built-in policy: the README warns that anything you mount in can be an escalation path
  • nsjail: Isolation uses host-kernel namespaces, cgroups and seccomp-bpf filters; there is no separate guest kernel
  • nsjail: Linux only, and several features require root or enabled user namespaces

Both are worth piloting with your own image and region. See the full bubblewrap profile and nsjail profile, or the complete comparison.

More comparisons

Frequently asked questions

Is bubblewrap or nsjail better for AI agents?
Neither is better for every workload. bubblewrap suits lightweight process sandboxing on Linux where you control the policy and do not need a kernel boundary. nsjail suits running untrusted programs or network services under tight syscall, memory and CPU limits on Linux.
What is the difference between bubblewrap and nsjail?
bubblewrap uses Linux namespaces; nsjail uses Namespaces + seccomp. bubblewrap is licensed LGPL-2.1; nsjail is licensed Apache-2.0.
Which is open source, bubblewrap or nsjail?
Both are open source (bubblewrap: LGPL-2.1; nsjail: Apache-2.0).
How do bubblewrap and nsjail isolate code?
bubblewrap: Unprivileged Linux user, mount, PID, network, IPC and UTS namespaces with a tmpfs root, PR_SET_NO_NEW_PRIVS and optional seccomp filters; the caller defines the policy. nsjail: Linux UTS, mount, PID, IPC, network, user, cgroup and time namespaces, cgroup v1/v2 limits, rlimits, chroot/pivot_root and seccomp-bpf syscall filters written in Kafel.
How does bubblewrap pricing compare with nsjail?
bubblewrap: Free and open source. nsjail: Free and open source. Rates change, so check the bubblewrap and nsjail pricing pages before deciding.
Can you self-host bubblewrap or nsjail?
Yes, both can be self-hosted.
How long can sessions run on bubblewrap and nsjail?
bubblewrap: Not documented. nsjail: Configurable CPU-time rlimit and wall-clock time limit per jail.
Do bubblewrap and nsjail support snapshots or pause and resume?
bubblewrap: snapshots none documented, pause and resume none documented. nsjail: snapshots none documented, pause and resume none documented.

Sources

  1. github.com/containers/bubblewrap
  2. github.com/containers/bubblewrap/releases
  3. github.com/anthropic-experimental/sandbox-runtime
  4. github.com/containers/bubblewrap/blob/main/README.md
  5. github.com/google/nsjail
  6. github.com/google/nsjail/blob/master/README.md
  7. nsjail.dev
  8. github.com/google/nsjail/releases

Check before you rely on it. Products change quickly, and this page reflects public documentation as of November 14, 2026. Confirm anything that matters in the provider’s own documentation.

Cite this page

Agent Sandboxes. (2026). bubblewrap vs nsjail. agentsandboxes.org. Last reviewed November 14, 2026. https://agentsandboxes.org/compare/bubblewrap-vs-nsjail/