A browser sandbox is a boundary that stops code running in a browser from reaching things it should not. The term has two meanings, and engineers who build browser agents need both.
- The browser's own sandbox. Chromium, Firefox and Safari split the browser into processes and run the ones that handle web content with very few rights.
- A sandbox around the browser. The whole browser runs inside an isolated environment, such as a container or a virtual machine, that is thrown away after use. This is what people mean by a browser sandbox for an AI agent.
What is the browser's built-in sandbox?
The built-in sandbox is a set of operating system restrictions that Chromium applies to the processes that render web pages. Chromium's design document puts the goal this way: the sandbox lets "code execution that cannot make persistent changes to the computer or access information that is confidential" happen (Chromium sandbox design, read 2026-11-24).
It works per process. The same document says "Sandbox operates at process-level granularity" and that "Anything that needs to be sandboxed needs to live on a separate process." The renderer, the process that runs a page's HTML and JavaScript, is the main target: "In Chromium, the renderers are always target processes, unless the --no-sandbox command line has been specified for the browser process."
On Linux, Chromium describes two layers (Linux sandboxing, Chromium 112 docs, read 2026-11-24):
- Layer 1, the "semantics" layer, "prevents access to most resources from a process where it's engaged". It uses user namespaces where the kernel allows them, and a setuid helper otherwise.
- Layer 2, the "attack surface reduction" layer, "restricts access from a process to the attack surface of the kernel". It does this with a system-call filter.
The current Linux design notes list the building blocks Chromium can use, including namespaces, system-call filtering, SELinux and AppArmor (sandbox/linux README, read 2026-11-24).
What does --no-sandbox actually turn off?
--no-sandbox turns off Chromium's process sandbox for every process type that normally has one. Chromium's own switch definition says it "Disables the sandbox for all process types that are normally sandboxed. Meant to be used as a browser-level switch for testing purposes only" (sandbox policy switches, read 2026-11-24).
Puppeteer's troubleshooting guide is direct about it: "Running without a sandbox is strongly discouraged. Consider configuring a sandbox instead." It allows the flag only "If you absolutely trust the content you open in Chrome" (Puppeteer troubleshooting, read 2026-11-24).
The flag is common in containers because the sandbox needs user namespaces, and many containers block them or run the browser as root. The fix, covered in our guide to running Chromium in Docker for an AI agent, is to run as a normal user and allow namespaces, rather than dropping the sandbox.
What is a sandbox around the browser?
A sandbox around the browser is an isolated machine or container that holds the whole browser, its profile, its downloads and the program that drives it. When the session ends, the environment is deleted.
This layer answers a different question. Chromium's sandbox asks "can this web page escape its tab?" The outer sandbox asks "what can this browser, and the agent driving it, touch at all?" That includes:
- the files on the machine, including the browser profile with its cookies;
- the network, including internal services and cloud metadata addresses;
- other sessions running on the same host;
- the secrets the agent was given to log in.
Research on computer-use agents uses the same idea. The OSWorld authors run every task in a virtual machine because it "offers a safe isolated environment" and "prevents the agent resulting in irreversible damaging effect on the real host machine" (OSWorld paper, section 2.2, read 2026-11-24).
How do the two kinds of browser sandbox compare?
The built-in sandbox protects the computer from a web page; a sandbox around the browser protects your systems from the whole browser and the agent driving it. An agent setup usually needs both.
Table: The two meanings of "browser sandbox"
| Question | Built-in process sandbox | Sandbox around the browser |
|---|---|---|
| What it holds | One renderer or helper process | The whole browser, its profile and its driver |
| What it protects | The computer, from web pages | Your systems and data, from the browser and the agent |
| Who sets it up | The browser, automatically | You, or the platform that runs the browser |
| Typical tools | Namespaces, a system-call filter, setuid helper | Containers, virtual machines, separate user accounts |
| Lifetime | The life of the process | One session, then deleted |
| Turned off by | --no-sandbox | Running the browser directly on a shared host |
Why does an AI agent need a browser sandbox?
An AI agent needs a browser sandbox because it acts on content it does not control. A person clicks what they choose. An agent reads each page and may follow instructions hidden in it. The OWASP Top 10 for LLM applications calls this indirect prompt injection: it happens "when an LLM accepts input from external sources, such as websites or files" (OWASP LLM01:2025, read 2026-11-24).
Chromium's sandbox does nothing about that. A hijacked agent does not need to escape a renderer. It can use the browser normally: open an internal admin page, download a file, or post a form with data it saw earlier. An outer sandbox limits the damage by limiting what the browser can reach and what survives the session.
The usual properties engineers ask of an agent's browser sandbox are:
- A clean start. A fresh profile for each task, so one task's cookies cannot leak into the next.
- No shared host state. No access to the host's files, other users' sessions or local services.
- Controlled network. An allow-list of sites, with internal address ranges blocked.
- Secrets outside the model's view. Logins injected by the harness, not pasted into the prompt.
- A record. A trace or video of what the agent did, kept for debugging.
- Fast disposal. The environment is deleted after the task, with everything in it.
Is a browser sandbox the same as a disposable or online browser?
Mostly, yes. A disposable browser is a browser sandbox used for a single session. Security teams use one to open suspicious links. Test teams use one for each test run. Agent builders use one for each task. In every case the important part is that nothing persists unless you choose to save it, for example a login state file.
Is a browser sandbox foolproof?
No sandbox is foolproof. Chromium's process sandbox reduces what a compromised renderer can do, but browser exploit chains that escape it are reported and patched regularly, which is why keeping the browser updated matters. An outer sandbox adds a second boundary. It still depends on its own configuration: a container that shares the host network, or a profile directory mounted from the host, removes much of its value.
The practical rule is to keep both layers. Leave Chromium's sandbox on, and run the browser inside an environment that you can throw away.
What we read for this article
- Chromium sandbox design document, read 2026-11-24
- Chromium Linux sandboxing, Chromium 112 docs, read 2026-11-24
- Chromium sandbox/linux README, read 2026-11-24
- Chromium sandbox policy switches, read 2026-11-24
- Puppeteer troubleshooting, read 2026-11-24
- OWASP LLM01:2025 Prompt Injection, read 2026-11-24
- OSWorld paper (arXiv 2404.07972), read 2026-11-24
Frequently asked
Is a browser sandbox the same as incognito mode?
No. Incognito, or a fresh browser context, keeps cookies and storage apart between sessions. A sandbox limits what code can reach on the computer. An agent setup usually wants both.
Does running Chrome with --no-sandbox make it unsafe?
It turns off Chromium's own process sandbox for every process that would normally have one. Chromium describes the switch as being for testing only, and Puppeteer's documentation says running without a sandbox is strongly discouraged unless you absolutely trust the content.
Do I need a separate sandbox if Chrome already has one?
For an AI agent, usually yes. Chrome's sandbox protects the computer from web pages, but the agent's driver, downloads, credentials and network access sit outside it. A container or virtual machine around the whole browser limits those too.
What is a disposable browser?
A browser that starts from a clean profile in an isolated environment and is thrown away when the session ends, with its cookies, files and history.