From 7ba74bbb014fc58d79e38212bfb69599166196f0 Mon Sep 17 00:00:00 2001 From: Daniel Prevoznik Date: Wed, 24 Sep 2025 15:15:30 -0400 Subject: [PATCH 1/6] 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. --- docs.json | 1 + integrations/browser-use.mdx | 103 +++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 integrations/browser-use.mdx diff --git a/docs.json b/docs.json index 3cbe64f..340b812 100644 --- a/docs.json +++ b/docs.json @@ -81,6 +81,7 @@ { "group": "Integrations", "pages": [ + "integrations/browser-use", "integrations/valtown", "integrations/vercel" ] diff --git a/integrations/browser-use.mdx b/integrations/browser-use.mdx new file mode 100644 index 0000000..bee53fb --- /dev/null +++ b/integrations/browser-use.mdx @@ -0,0 +1,103 @@ +--- +title: "Browser Use" +--- + +[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. + +## Adding Kernel to existing Browser Use implementations + +If you already have a Browser Use implementation, you can easily switch to using Kernel's cloud browsers by updating your Browser definition. + +### 1. Install the Kernel SDK + +```bash +pip install onkernel +``` + +### 2. Initialize Kernel and create a browser + +Import the libraries and create a cloud browser session: + +```python +from onkernel import Kernel +from browser_use import Browser, Agent + +# Initialize Kernel client +kernel = Kernel(api_key="your-api-key") + +# Create a Kernel browser session +kernel_browser = kernel.browsers.create() +``` + +### 3. Update your Browser definition + +Replace your existing Browser initialization to use Kernel's CDP URL and display settings: + +```python +# Update your Browser definition to use Kernel's CDP URL +browser = Browser( + cdp_url=kernel_browser.cdp_ws_url, + headless=False, + window_size={'width': 1024, 'height': 786}, + viewport={'width': 1024, 'height': 786}, + device_scale_factor=1.0 +) +``` + +### 4. Create and run your agent + +Use your existing Agent setup with the Kernel-powered browser: + +```python +# Use with your existing Agent setup +agent = Agent( + task="Your automation task", + llm=your_llm_instance, + browser_session=browser +) + +# Run your automation +result = agent.run() + +# Clean up +kernel.browsers.delete_by_id(kernel_browser.session_id) +``` + + +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: + +```python +agent = Agent( + task="Your automation task", + llm=your_llm_instance, + browser_session=BrowserSessionCustomResize(cdp_url=kernel_browser.cdp_ws_url) +) +``` + + +## Quick setup with our Browser Use example app + +Alternatively, you can use our Kernel app template that includes a pre-configured Browser Use integration: + +```bash +npx @onkernel/create-kernel-app my-browser-use-app +``` + +Choose Python as the programming language and then select `browser-use` as the template. + +Then follow the [Quickstart guide](/quickstart/) to deploy and run your Browser Use automation on Kernel's infrastructure. + +## Benefits of using Kernel with Browser Use + +- **No local browser management**: Run automations without installing or maintaining browsers locally +- **Scalability**: Launch multiple browser sessions in parallel +- **Stealth mode**: Built-in anti-detection features for web scraping +- **Session persistence**: Maintain browser state across automation runs +- **Live view**: Debug your automations with real-time browser viewing + +## Next steps + +- Check out [live view](/browsers/live-view) for debugging your automations +- Learn about [stealth mode](/browsers/stealth) for avoiding detection +- Learn how to properly [terminate browser sessions](/browsers/termination) +- Learn how to [deploy](/apps/deploy) your Browser Use app to Kernel \ No newline at end of file From 9949471da70cc964bbeb75347090eb0611ff3705 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 24 Sep 2025 19:15:48 +0000 Subject: [PATCH 2/6] docs: update code samples from OpenAPI --- snippets/openapi/delete-browsers-id.mdx | 2 +- snippets/openapi/delete-proxies-id.mdx | 23 ++++++++++++++++++++++ snippets/openapi/get-browsers-id.mdx | 2 +- snippets/openapi/get-invocations-id.mdx | 2 +- snippets/openapi/get-proxies-id.mdx | 26 +++++++++++++++++++++++++ snippets/openapi/get-proxies.mdx | 24 +++++++++++++++++++++++ snippets/openapi/post-proxies.mdx | 26 +++++++++++++++++++++++++ 7 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 snippets/openapi/delete-proxies-id.mdx create mode 100644 snippets/openapi/get-proxies-id.mdx create mode 100644 snippets/openapi/get-proxies.mdx create mode 100644 snippets/openapi/post-proxies.mdx diff --git a/snippets/openapi/delete-browsers-id.mdx b/snippets/openapi/delete-browsers-id.mdx index cdf3340..950e158 100644 --- a/snippets/openapi/delete-browsers-id.mdx +++ b/snippets/openapi/delete-browsers-id.mdx @@ -17,7 +17,7 @@ client = Kernel( api_key="My API Key", ) client.browsers.delete_by_id( - "id", + "htzv5orfit78e1m2biiifpbv", ) ``` diff --git a/snippets/openapi/delete-proxies-id.mdx b/snippets/openapi/delete-proxies-id.mdx new file mode 100644 index 0000000..3866791 --- /dev/null +++ b/snippets/openapi/delete-proxies-id.mdx @@ -0,0 +1,23 @@ + +```typescript Typescript/Javascript +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', +}); + +await client.proxies.delete('id'); +``` + + +```python Python +from kernel import Kernel + +client = Kernel( + api_key="My API Key", +) +client.proxies.delete( + "id", +) +``` + diff --git a/snippets/openapi/get-browsers-id.mdx b/snippets/openapi/get-browsers-id.mdx index bc84e3b..6c6e3b4 100644 --- a/snippets/openapi/get-browsers-id.mdx +++ b/snippets/openapi/get-browsers-id.mdx @@ -19,7 +19,7 @@ client = Kernel( api_key="My API Key", ) browser = client.browsers.retrieve( - "id", + "htzv5orfit78e1m2biiifpbv", ) print(browser.session_id) ``` diff --git a/snippets/openapi/get-invocations-id.mdx b/snippets/openapi/get-invocations-id.mdx index 7dbd194..277a603 100644 --- a/snippets/openapi/get-invocations-id.mdx +++ b/snippets/openapi/get-invocations-id.mdx @@ -19,7 +19,7 @@ client = Kernel( api_key="My API Key", ) invocation = client.invocations.retrieve( - "id", + "rr33xuugxj9h0bkf1rdt2bet", ) print(invocation.id) ``` diff --git a/snippets/openapi/get-proxies-id.mdx b/snippets/openapi/get-proxies-id.mdx new file mode 100644 index 0000000..c2d7c42 --- /dev/null +++ b/snippets/openapi/get-proxies-id.mdx @@ -0,0 +1,26 @@ + +```typescript Typescript/Javascript +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', +}); + +const proxy = await client.proxies.retrieve('id'); + +console.log(proxy.id); +``` + + +```python Python +from kernel import Kernel + +client = Kernel( + api_key="My API Key", +) +proxy = client.proxies.retrieve( + "id", +) +print(proxy.id) +``` + diff --git a/snippets/openapi/get-proxies.mdx b/snippets/openapi/get-proxies.mdx new file mode 100644 index 0000000..7df6a00 --- /dev/null +++ b/snippets/openapi/get-proxies.mdx @@ -0,0 +1,24 @@ + +```typescript Typescript/Javascript +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', +}); + +const proxies = await client.proxies.list(); + +console.log(proxies); +``` + + +```python Python +from kernel import Kernel + +client = Kernel( + api_key="My API Key", +) +proxies = client.proxies.list() +print(proxies) +``` + diff --git a/snippets/openapi/post-proxies.mdx b/snippets/openapi/post-proxies.mdx new file mode 100644 index 0000000..7e81422 --- /dev/null +++ b/snippets/openapi/post-proxies.mdx @@ -0,0 +1,26 @@ + +```typescript Typescript/Javascript +import Kernel from '@onkernel/sdk'; + +const client = new Kernel({ + apiKey: 'My API Key', +}); + +const proxy = await client.proxies.create({ type: 'datacenter' }); + +console.log(proxy.id); +``` + + +```python Python +from kernel import Kernel + +client = Kernel( + api_key="My API Key", +) +proxy = client.proxies.create( + type="datacenter", +) +print(proxy.id) +``` + From 1d12cdde1add8974ebf6ea1dac2d07b64bd8e0ea Mon Sep 17 00:00:00 2001 From: Daniel Prevoznik Date: Wed, 24 Sep 2025 15:59:17 -0400 Subject: [PATCH 3/6] Update browser-use.mdx Updated to UV method and included dependency name. --- integrations/browser-use.mdx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/integrations/browser-use.mdx b/integrations/browser-use.mdx index bee53fb..d9e093b 100644 --- a/integrations/browser-use.mdx +++ b/integrations/browser-use.mdx @@ -10,8 +10,19 @@ If you already have a Browser Use implementation, you can easily switch to using ### 1. Install the Kernel SDK +Add Kernel to your project dependencies in `pyproject.toml`: + +```toml +dependencies = [ + "kernel>=0.11.1", + # ... your other dependencies +] +``` + +Then install it using uv: + ```bash -pip install onkernel +uv pip install kernel ``` ### 2. Initialize Kernel and create a browser From 1e2914b4c9a2ab499b9c129666b2eefdafb56636 Mon Sep 17 00:00:00 2001 From: Daniel Prevoznik Date: Wed, 24 Sep 2025 16:04:00 -0400 Subject: [PATCH 4/6] Simplified kernel install Simplified to use uv add instead of two steps --- integrations/browser-use.mdx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/integrations/browser-use.mdx b/integrations/browser-use.mdx index d9e093b..2f35724 100644 --- a/integrations/browser-use.mdx +++ b/integrations/browser-use.mdx @@ -10,19 +10,8 @@ If you already have a Browser Use implementation, you can easily switch to using ### 1. Install the Kernel SDK -Add Kernel to your project dependencies in `pyproject.toml`: - -```toml -dependencies = [ - "kernel>=0.11.1", - # ... your other dependencies -] -``` - -Then install it using uv: - ```bash -uv pip install kernel +uv add kernel ``` ### 2. Initialize Kernel and create a browser From ec2fa063308103eb172744ac5aac01fce71b9681 Mon Sep 17 00:00:00 2001 From: Daniel Prevoznik Date: Wed, 24 Sep 2025 16:13:11 -0400 Subject: [PATCH 5/6] Update kernel import Updated kernel import --- integrations/browser-use.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/browser-use.mdx b/integrations/browser-use.mdx index 2f35724..81ca310 100644 --- a/integrations/browser-use.mdx +++ b/integrations/browser-use.mdx @@ -19,7 +19,7 @@ uv add kernel Import the libraries and create a cloud browser session: ```python -from onkernel import Kernel +from kernel import Kernel from browser_use import Browser, Agent # Initialize Kernel client From a2b4c5f94a7f6bc7afa6826ce0164c2cdd04bef6 Mon Sep 17 00:00:00 2001 From: Daniel Prevoznik Date: Wed, 24 Sep 2025 16:19:56 -0400 Subject: [PATCH 6/6] Change kernel to client variable name To avoid confusion, changing name of class to client instead of the package name kernel --- integrations/browser-use.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integrations/browser-use.mdx b/integrations/browser-use.mdx index 81ca310..87efc76 100644 --- a/integrations/browser-use.mdx +++ b/integrations/browser-use.mdx @@ -23,10 +23,10 @@ from kernel import Kernel from browser_use import Browser, Agent # Initialize Kernel client -kernel = Kernel(api_key="your-api-key") +client = Kernel(api_key="your-api-key") # Create a Kernel browser session -kernel_browser = kernel.browsers.create() +kernel_browser = client.browsers.create() ``` ### 3. Update your Browser definition @@ -60,7 +60,7 @@ agent = Agent( result = agent.run() # Clean up -kernel.browsers.delete_by_id(kernel_browser.session_id) +client.browsers.delete_by_id(kernel_browser.session_id) ```