← Blog2026-11-22

A browser and a desktop for agents in 1 GiB

Our smallest sandbox has 1 GiB of memory. This is how we fit a headless Chromium with open DevTools, and a desktop that E2B's desktop SDK can drive, into it, and how many tabs each holds.

Agents that browse need a browser somewhere, and agents that use a computer need a whole desktop. Both are usually given 4 to 8 GiB. Our default templates give a sandbox 2 vCPU and 1 GiB, so we set out to make both work there, and to measure where they stop working. The numbers below are from our test cluster, read inside the sandbox as MemTotal minus MemAvailable; a 1 GiB sandbox sees 976 MiB.

Which Chromium

We opened the same Wikipedia page in three builds of Chromium, each in a fresh 1 GiB sandbox (MiB used):

BuildIdleOne page openVerdict
Debian chromium, --headless=new270–347484–487Adds a GPU process, two zygotes and a WebUI renderer
The same with --single-process --no-zygote280374One crashed page takes everything down
Chrome for Testing chrome-headless-shell239–243348–391Chosen

chrome-headless-shell is the old headless mode without the browser UI layer, and is what Playwright launches by default for headless runs. It saves about 100 MiB against the new headless mode. Trimming further with --no-zygote --in-process-gpu made no measurable difference, so we left those out. We keep only four locales and one small CJK font (5 MB), so Chinese and Japanese pages render in screenshots.

Opening DevTools to the internet

Recent Chromium listens for DevTools on localhost only, and refuses requests whose Host header is neither an IP nor localhost. From outside, the sandbox's port is https://9222-<sandbox id>.lumicloud.dev, so both rules get in the way. A small nginx in the template listens on 9222 and does two things: it rewrites the Host header to localhost for Chromium, and it rewrites the webSocketDebuggerUrl that /json/version returns, from ws://localhost to the wss:// address the caller used. Playwright and Puppeteer fetch /json/version and follow that URL, so they connect with no extra setup. nginx costs about 2 MiB.

pythonfrom e2b import Sandbox
from playwright.sync_api import sync_playwright

with Sandbox.create("browser") as sandbox, sync_playwright() as p:
    browser = p.chromium.connect_over_cdp("https://" + sandbox.get_host(9222))
    page = browser.contexts[0].new_page()
    page.goto("https://en.wikipedia.org/wiki/Singapore")
    page.screenshot(path="page.png")

The browser is already running when the sandbox starts. The template's start command runs at build time and the snapshot keeps the running process, so creating a browser sandbox takes about 0.3 s and there is no launch to wait for.

How many tabs fit

Browser1 GiB: used (available)2 GiB: used (available)
Idle237 (738)247 (1735)
example.com273 (703)278 (1704)
2 tabs, one Wikipedia page418 (557)411 (1570)
6 tabs, five Wikipedia pages797 (178)796 (1186)
12 tabs955 (20)1089 (893)

A heavy page costs 130 to 145 MiB. At twelve tabs the 1 GiB sandbox had 20 MiB left; the pages were still there and CDP still answered, but the kernel was reclaiming pages. For many tabs at once there is browser-2g, the same template with 2 GiB.

A desktop for E2B's desktop SDK

E2B's desktop SDK starts the desktop from the client side, with fixed commands: it runs Xvfb, then startxfce4, then checks with pgrep -x that processes named xfce4-session, xfwm4 and xfdesktop exist, then starts x11vnc and noVNC for the live view. E2B's own template installs a full XFCE with LibreOffice, Firefox, Chrome and VS Code, and runs at 8 vCPU and 8 GiB.

Ours runs Openbox as the window manager, at 10 to 15 MiB. startxfce4 in our template is a script that starts Openbox under the name xfwm4, plus two idle processes named xfce4-session and xfdesktop: symbolic links to sleep, which take their name from the link and cost under 1 MiB each. The SDK sees the three names it checks for, and everything else it does (screenshots with scrot, mouse and keyboard with xdotool, launch("google-chrome")) works as on E2B. noVNC and websockify are the same commits as E2B's template.

pythonfrom e2b_desktop import Sandbox

desktop = Sandbox.create()          # the desktop template is the SDK's default
desktop.stream.start()
print(desktop.stream.get_url())     # watch it live
desktop.launch("google-chrome")
desktop.screenshot()
Desktop1 GiB: used (available)2 GiB: used (available)
Idle (Xvfb and Openbox)205 (770)216 (1766)
With the live view231 (744)241 (1741)
Chromium with a window, example.com354 (621)406 (1576)
2 tabs, one Wikipedia page536 (439)547 (1435)
6 tabs, five Wikipedia pages916 (59)940 (1042)

Three or four heavy pages are comfortable in 1 GiB; at six the desktop slows down. desktop-2g keeps more than half its memory free for the same work. A desktop sandbox is created in 3 to 5 s, most of it the SDK starting Xvfb; the live view takes another 1.5 to 3 s.

What we left out

  • XFCE, LibreOffice, Firefox, VS Code, ffmpeg and a panel: hundreds of MB of disk and tens of MiB of memory that most agents never touch.
  • Swap. When memory runs short, the kernel drops cached pages and the sandbox slows down; nothing is paged out to disk.
  • Changing the User-Agent. It says HeadlessChrome and some sites refuse it; set your own with Playwright's user_agent= if you need to.

Both templates are public on LumiCloud: browser, browser-2g, desktop and desktop-2g. The templates page of the docs has their sizes and usage.