Skip to content

Commit b3fd603

Browse files
committed
docs: Improve remote browser page flow and structure
Lead with why (no sandbox compute wasted, zero install, CAPTCHA handling, parallel browsing), show two approaches upfront, then streamlined walkthroughs.
1 parent 6d2af4f commit b3fd603

1 file changed

Lines changed: 41 additions & 62 deletions

File tree

docs/use-cases/remote-browser.mdx

Lines changed: 41 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@ description: "Use Kernel cloud browsers with E2B sandboxes for web scraping, app
44
icon: "globe"
55
---
66

7-
[Kernel](https://www.kernel.computer/) provides cloud browsers — remote Chromium instances you can control programmatically via [CDP](https://chromedevtools.github.io/devtools-protocol/). Combined with E2B sandboxes, your agents can browse the web without running a browser locally.
7+
[Kernel](https://www.kernel.computer/) provides cloud browsers — remote Chromium instances your agents can control via [CDP](https://chromedevtools.github.io/devtools-protocol/) (Chrome DevTools Protocol).
88

9-
E2B provides pre-built sandbox templates with the Kernel SDK and Playwright already installed:
9+
## Why use a remote browser?
1010

11-
| Template | Includes | Use case |
11+
Running a browser inside the sandbox works, but offloading it to Kernel has real advantages:
12+
13+
- **No sandbox compute wasted on Chrome** — Chromium is resource-hungry. Kernel runs it on dedicated infrastructure so your sandbox CPU and memory stay available for your agent's actual work.
14+
- **Zero installation** — no need to install Chrome, Chromium, or Playwright binaries in your sandbox template. Kernel provides the browser remotely.
15+
- **Built-in CAPTCHA and bot detection handling** — Kernel browsers support stealth mode, residential proxies, and browser profiles that persist cookies and sessions across runs.
16+
- **Parallel browsing** — spin up multiple Kernel browsers simultaneously without multiplying sandbox costs.
17+
18+
## Two approaches
19+
20+
E2B provides pre-built sandbox templates with the Kernel SDK already installed:
21+
22+
| Template | What's included | Best for |
1223
|---|---|---|
13-
| `kernel-browser` | Kernel SDK, Playwright | Programmatic browsing, screenshots, scraping |
14-
| `kernel-agent-browser` | Kernel SDK, Playwright, Browser Use | Autonomous AI agent browsing |
24+
| `kernel-browser` | Kernel SDK, Playwright | Programmatic browsing — screenshots, scraping, app previews |
25+
| `kernel-agent-browser` | Kernel SDK, Playwright, Browser Use | Autonomous AI agents that browse on their own |
26+
27+
Both templates connect to Kernel browsers over CDP. The difference is whether *you* write the browsing logic or an *LLM agent* decides what to do.
1528

1629
## Prerequisites
1730

@@ -30,29 +43,26 @@ E2B_API_KEY=e2b_***
3043
KERNEL_API_KEY=kernel_***
3144
```
3245

33-
## App preview with Kernel
46+
## Programmatic browsing
47+
48+
Use this approach when you know exactly what pages to visit and what to do on them — taking screenshots, scraping data, or generating previews.
3449

35-
Deploy a web app inside a sandbox, get a public URL, then use a Kernel browser to visit every route, capture screenshots, and produce a preview report.
50+
This example deploys a web app inside a sandbox, gets a public URL, then uses a Kernel browser to screenshot every route.
3651

3752
<Steps>
38-
<Step title="Create the sandbox">
39-
Start an E2B sandbox using the `kernel-browser` template. No local browser binary is needed — Kernel provides the browser remotely.
53+
<Step title="Create the sandbox and deploy your app">
54+
Start a sandbox with the `kernel-browser` template, write your web app into it, and start the server.
4055

4156
```python
57+
import os
4258
from e2b import Sandbox
4359

4460
sandbox = Sandbox.create(
4561
"kernel-browser",
4662
envs={"KERNEL_API_KEY": os.environ["KERNEL_API_KEY"]},
4763
timeout=300,
4864
)
49-
```
50-
</Step>
51-
52-
<Step title="Deploy the web app">
53-
Write a FastAPI application into the sandbox and start it as a background process on port 8000.
5465

55-
```python
5666
sandbox.files.write("/home/user/app.py", FASTAPI_APP)
5767
sandbox.commands.run(
5868
"pip install --break-system-packages fastapi uvicorn",
@@ -66,19 +76,14 @@ sandbox.commands.run(
6676
```
6777
</Step>
6878

69-
<Step title="Get the public URL">
70-
E2B exposes any sandbox port as a public HTTPS endpoint.
79+
<Step title="Get the public URL and browse with Kernel">
80+
E2B exposes any sandbox port as a public HTTPS endpoint. A script inside the sandbox creates a Kernel browser, connects via Playwright CDP, and screenshots each route.
7181

7282
```python
7383
host = sandbox.get_host(8000)
7484
app_url = f"https://{host}"
75-
```
76-
</Step>
7785

78-
<Step title="Browse with Kernel">
79-
A script running inside the sandbox creates a Kernel cloud browser, connects via Playwright CDP, and visits each route to take screenshots.
80-
81-
```python
86+
# This runs inside the sandbox
8287
from kernel import Kernel
8388
from playwright.sync_api import sync_playwright
8489

@@ -95,8 +100,8 @@ with sync_playwright() as pw:
95100
```
96101
</Step>
97102

98-
<Step title="Generate the preview report">
99-
After visiting every route, the script writes a JSON report with page titles and screenshot paths. The orchestrator reads it back from the sandbox.
103+
<Step title="Read the results">
104+
After visiting every route, read the report back from the sandbox.
100105

101106
```python
102107
import json
@@ -251,9 +256,9 @@ if __name__ == "__main__":
251256
main()
252257
```
253258

254-
## Agent browser with Browser Use
259+
## Autonomous agent browsing
255260

256-
Add the [Browser Use](https://docs.browser-use.com/) framework to give an LLM autonomous control over a Kernel browser. The agent sees the page via screenshots and decides what to click, type, and navigate — you just give it a task.
261+
Use this approach when you want an LLM to decide what to click, type, and navigate. The [Browser Use](https://docs.browser-use.com/) framework connects an LLM to the Kernel browser — the agent sees the page via screenshots and autonomously completes tasks.
257262

258263
This requires an additional LLM API key (Anthropic, OpenAI, or other [supported model](https://docs.browser-use.com/customize/supported-models)):
259264

@@ -263,7 +268,7 @@ ANTHROPIC_API_KEY=sk-ant-***
263268

264269
<Steps>
265270
<Step title="Create the sandbox">
266-
Start an E2B sandbox using the `kernel-agent-browser` template, which includes Browser Use on top of the Kernel SDK and Playwright.
271+
Use the `kernel-agent-browser` template, which includes Browser Use on top of the Kernel SDK and Playwright.
267272

268273
```python
269274
from e2b import Sandbox
@@ -279,8 +284,8 @@ sandbox = Sandbox.create(
279284
```
280285
</Step>
281286

282-
<Step title="Write the agent script">
283-
The agent script creates a Kernel browser, connects Browser Use to it, and runs a task autonomously.
287+
<Step title="Write and run the agent">
288+
The agent script creates a Kernel browser, connects Browser Use, and runs a task autonomously. You just describe what you want done.
284289

285290
```python
286291
AGENT_SCRIPT = '''
@@ -291,7 +296,6 @@ from browser_use import Agent, Browser, ChatAnthropic
291296
async def main():
292297
kernel = Kernel()
293298
kb = kernel.browsers.create()
294-
295299
browser = Browser(cdp_url=kb.cdp_ws_url)
296300
297301
agent = Agent(
@@ -306,17 +310,7 @@ asyncio.run(main())
306310
'''
307311

308312
sandbox.files.write("/home/user/agent_task.py", AGENT_SCRIPT)
309-
```
310-
</Step>
311-
312-
<Step title="Run the agent">
313-
Execute the agent inside the sandbox. The agent will autonomously browse, click, type, and navigate to complete the task.
314-
315-
```python
316-
result = sandbox.commands.run(
317-
"python3 /home/user/agent_task.py",
318-
timeout=180,
319-
)
313+
result = sandbox.commands.run("python3 /home/user/agent_task.py", timeout=180)
320314
print(result.stdout)
321315
```
322316
</Step>
@@ -427,9 +421,7 @@ if __name__ == "__main__":
427421

428422
## Kernel MCP tools
429423

430-
The [Kernel MCP Server](https://mcp.onkernel.com/mcp) exposes 10 tools over the Model Context Protocol. Connect any MCP-compatible client — no installation needed.
431-
432-
Install for CLI tools:
424+
The [Kernel MCP Server](https://mcp.onkernel.com/mcp) exposes 10 tools over the Model Context Protocol, letting MCP-compatible clients manage browsers without any SDK installation.
433425

434426
```bash
435427
kernel mcp install --target <target> # Supports Cursor, Claude Desktop, VS Code, etc.
@@ -458,30 +450,17 @@ Authentication uses OAuth 2.0 via Clerk.
458450

459451
## Deploying Kernel skills
460452

461-
An agent running inside the sandbox can use the Kernel CLI to create, deploy, and invoke browser automation skills — turning any one-off workflow into a persistent, reusable automation.
453+
An agent running inside the sandbox can use the Kernel CLI to package any browser workflow as a persistent, reusable automation.
462454

463455
```python
464-
# Agent deploys a reusable browser automation skill
456+
# Create a new skill from a template
465457
sandbox.commands.run("kernel create --name price-checker --language python --template browser-use", cwd="/home/user")
466-
# ... agent writes the automation code ...
458+
# Deploy it
467459
sandbox.commands.run("kernel deploy main.py --env-file .env", cwd="/home/user/price-checker")
468-
# Later, invoke the deployed skill
460+
# Invoke it later
469461
sandbox.commands.run('kernel invoke price-checker check --payload \'{"url": "https://example.com"}\'')
470462
```
471463

472-
## Key concepts
473-
474-
| Concept | Detail |
475-
|---|---|
476-
| **E2B templates** | `kernel-browser` and `kernel-agent-browser` — pre-built with the Kernel SDK and Playwright |
477-
| **Public URL** | `sandbox.get_host(port)` returns an HTTPS hostname for any sandbox port |
478-
| **Background process** | `sandbox.commands.run(..., background=True)` starts a web server without blocking |
479-
| **Kernel browser** | `kernel.browsers.create()` spins up a remote Chromium; connect via `kb.cdp_ws_url` |
480-
| **CDP connection** | Playwright's `connect_over_cdp()` drives the remote browser with full API access |
481-
| **Browser Use** | Agent framework that connects an LLM to Playwright for autonomous browsing |
482-
| **Kernel MCP Server** | Hosted at `https://mcp.onkernel.com/mcp` — 10 MCP tools for browser management and automation |
483-
| **Kernel Skills** | `kernel create` + `kernel deploy` packages browser automations as persistent, invokable skills |
484-
485464
## Related guides
486465

487466
<CardGroup cols={3}>

0 commit comments

Comments
 (0)