Skip to content

Commit 7ba74bb

Browse files
committed
Add browser use guide
Added browser user integration guide to docs. It includes a guide for integrating into an existing browser use implementation as well as starting from scratch with our app template.
1 parent 67a3532 commit 7ba74bb

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
{
8282
"group": "Integrations",
8383
"pages": [
84+
"integrations/browser-use",
8485
"integrations/valtown",
8586
"integrations/vercel"
8687
]

integrations/browser-use.mdx

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "Browser Use"
3+
---
4+
5+
[Browser Use](https://github.com/browser-use/browser-use) is the AI browser agent that empowers anyone to automate repetitive online tasks, no code required. By integrating with Kernel, you can run Browser Use Agents and automations with cloud-hosted browsers.
6+
7+
## Adding Kernel to existing Browser Use implementations
8+
9+
If you already have a Browser Use implementation, you can easily switch to using Kernel's cloud browsers by updating your Browser definition.
10+
11+
### 1. Install the Kernel SDK
12+
13+
```bash
14+
pip install onkernel
15+
```
16+
17+
### 2. Initialize Kernel and create a browser
18+
19+
Import the libraries and create a cloud browser session:
20+
21+
```python
22+
from onkernel import Kernel
23+
from browser_use import Browser, Agent
24+
25+
# Initialize Kernel client
26+
kernel = Kernel(api_key="your-api-key")
27+
28+
# Create a Kernel browser session
29+
kernel_browser = kernel.browsers.create()
30+
```
31+
32+
### 3. Update your Browser definition
33+
34+
Replace your existing Browser initialization to use Kernel's CDP URL and display settings:
35+
36+
```python
37+
# Update your Browser definition to use Kernel's CDP URL
38+
browser = Browser(
39+
cdp_url=kernel_browser.cdp_ws_url,
40+
headless=False,
41+
window_size={'width': 1024, 'height': 786},
42+
viewport={'width': 1024, 'height': 786},
43+
device_scale_factor=1.0
44+
)
45+
```
46+
47+
### 4. Create and run your agent
48+
49+
Use your existing Agent setup with the Kernel-powered browser:
50+
51+
```python
52+
# Use with your existing Agent setup
53+
agent = Agent(
54+
task="Your automation task",
55+
llm=your_llm_instance,
56+
browser_session=browser
57+
)
58+
59+
# Run your automation
60+
result = agent.run()
61+
62+
# Clean up
63+
kernel.browsers.delete_by_id(kernel_browser.session_id)
64+
```
65+
66+
<Info>
67+
If you're using Browser Use versions `< 0.7.9`, you may need to use a [custom resize class](https://github.com/onkernel/create-kernel-app/blob/main/templates/python/browser-use/session.py) to correct viewport sizing for the browser session. Here's how to use it:
68+
69+
```python
70+
agent = Agent(
71+
task="Your automation task",
72+
llm=your_llm_instance,
73+
browser_session=BrowserSessionCustomResize(cdp_url=kernel_browser.cdp_ws_url)
74+
)
75+
```
76+
</Info>
77+
78+
## Quick setup with our Browser Use example app
79+
80+
Alternatively, you can use our Kernel app template that includes a pre-configured Browser Use integration:
81+
82+
```bash
83+
npx @onkernel/create-kernel-app my-browser-use-app
84+
```
85+
86+
Choose Python as the programming language and then select `browser-use` as the template.
87+
88+
Then follow the [Quickstart guide](/quickstart/) to deploy and run your Browser Use automation on Kernel's infrastructure.
89+
90+
## Benefits of using Kernel with Browser Use
91+
92+
- **No local browser management**: Run automations without installing or maintaining browsers locally
93+
- **Scalability**: Launch multiple browser sessions in parallel
94+
- **Stealth mode**: Built-in anti-detection features for web scraping
95+
- **Session persistence**: Maintain browser state across automation runs
96+
- **Live view**: Debug your automations with real-time browser viewing
97+
98+
## Next steps
99+
100+
- Check out [live view](/browsers/live-view) for debugging your automations
101+
- Learn about [stealth mode](/browsers/stealth) for avoiding detection
102+
- Learn how to properly [terminate browser sessions](/browsers/termination)
103+
- Learn how to [deploy](/apps/deploy) your Browser Use app to Kernel

0 commit comments

Comments
 (0)