This example serves a small web app from an E2B sandbox and tests it with a Notte cloud browser. It is the pattern for agents that build or run code in a sandbox and then need a real browser to check the result.
The browser runs on Notte, not inside the sandbox, so the sandbox needs no Chromium install. The script:
- Creates an E2B sandbox, writes a to-do app into it and serves it on port 8000.
- Exposes the app on the sandbox's public URL with
sandbox.get_host(8000). - Starts a Notte browser session, prints its live viewer URL and uses
session.page, a Playwright page connected over CDP, to read the to-do list and save a screenshot tooutput/app.png. - Installs the latest Notte CLI in the
sandbox with
curl -fsSL https://notte.cc/install-cli.sh | sh, plus the Notte skills in~/.agents/skills, where coding agents such as Claude Code and Codex pick them up. - Drives a second browser session from inside the sandbox with CLI commands: open the app, add a to-do, and scrape the page to confirm it shows 3 to-dos.
- Stops both browser sessions and kills the sandbox.
The CLI commands in step 5 are the same ones a coding agent in the sandbox runs once the skill is installed:
notte sessions start
notte page goto https://8000-<sandbox-id>.e2b.app
notte page fill '#title' 'Ship the E2B example'
notte page click 'button[type=submit]'
notte page scrape --only-main-content
notte sessions stopInstall uv and run:
uv syncPlaywright only connects to the remote browser, so there is no need to run
playwright install.
cp .env.template .envFill in E2B_API_KEY from the E2B dashboard
and NOTTE_API_KEY from the Notte console.
uv run main.pyOpen the printed viewer URLs to watch the browsers while the script runs.
Replace APP_HTML and start_app() with whatever runs in your sandbox. Any
server listening on a sandbox port is reachable at
https://{sandbox.get_host(port)}, so the browser code does not change.