Kernel
Give the code in your sandbox a cloud browser. Your script runs in E2B and drives Chromium on Kernel over CDP with Playwright.
- E2B
- kernel-browser template, CDP
- kernel, @onkernel/sdk
- Python, TypeScript
Get started
Paste the prompt into your coding agent, or follow the steps yourself.
Paste this into your coding agent
Add E2B sandboxes and Kernel browsers to this project.
- 1.Install e2b, the Kernel SDK and Playwright (e2b kernel playwright for Python, e2b @onkernel/sdk playwright-core for TypeScript) using the project's package manager.
- 2.The code needs the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it. Ask me for KERNEL_API_KEY the same way.
- 3.Follow the cloud browser guide at https://docs.e2b.dev/use-cases/remote-browser: create a sandbox from the kernel-browser template with KERNEL_API_KEY in its envs, and run a script there that opens a Kernel browser and connects Playwright over CDP.
- 4.Run it once and show me the output that came from the sandbox, then kill the sandbox.
Or set it up yourself
1. Install the SDKs
2. Set your API keys
3. Start a sandbox and your app
4. Screenshot it with a Kernel browser
What runs in the sandbox
Your app and browsing scripts run in E2B. The browser itself runs on Kernel's infrastructure.
- Your app and scripts, in a sandbox from the kernel-browser template with the Kernel SDK, Playwright and Browser Use installed.
- Chromium runs on Kernel, not in the sandbox. Scripts connect to it over CDP.
- Any sandbox port gets a public HTTPS URL from get_host, so the Kernel browser can load the app you started.
- KERNEL_API_KEY goes into the sandbox through envs. Your E2B key stays on your machine.
More browser & computer use
Other ways to give agents a browser or a desktop on E2B.
- PlaywrightRun Playwright inside a sandbox, or connect it to a remote browser from one.
- OpenAI computer useGive OpenAI's computer-use model an E2B Desktop to see and control.
- Claude browser and computer-use toolsetsBack Claude's browser and computer-use toolsets with E2B drivers in Python or TypeScript.
