Skip to content

Commit 7c46bc1

Browse files
Danny/kernel 368 magnitude integration guide (#54)
* Browser Use Page Update Updated the browser use page to match the Magnitude page formatting. * Add Magnitude guide Added magnitude guide to the dev docs now that the create-kernel-app template is available. * docs: update code samples from OpenAPI --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 61bcebe commit 7c46bc1

File tree

4 files changed

+130
-1
lines changed

4 files changed

+130
-1
lines changed

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"group": "Integrations",
8383
"pages": [
8484
"integrations/browser-use",
85+
"integrations/magnitude",
8586
"integrations/valtown",
8687
"integrations/vercel"
8788
]

integrations/browser-use.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Alternatively, you can use our Kernel app template that includes a pre-configure
8383
npx @onkernel/create-kernel-app my-browser-use-app
8484
```
8585

86-
Choose Python as the programming language and then select `browser-use` as the template.
86+
Choose `Python` as the programming language and then select `Browser Use` as the template.
8787

8888
Then follow the [Quickstart guide](/quickstart/) to deploy and run your Browser Use automation on Kernel's infrastructure.
8989

integrations/magnitude.mdx

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: "Magnitude"
3+
---
4+
5+
[Magnitude](https://magnitude.run) is an open source AI browser automation framework. It uses vision AI to enable you to control your browser with natural language. By integrating with Kernel, you can run Magnitude agents and automations with cloud-hosted browsers.
6+
7+
## Adding Kernel to existing Magnitude implementations
8+
9+
If you already have a Magnitude implementation, you can easily switch to using Kernel's cloud browsers by updating your browser configuration.
10+
11+
### 1. Install the Kernel SDK
12+
13+
```bash
14+
npm install @onkernel/sdk
15+
```
16+
17+
### 2. Initialize Kernel and create a browser
18+
19+
Import the libraries and create a cloud browser session:
20+
21+
```typescript
22+
import { startBrowserAgent } from "magnitude-core";
23+
import Kernel from '@onkernel/sdk';
24+
import z from 'zod';
25+
26+
const client = new Kernel({
27+
apiKey: process.env.KERNEL_API_KEY,
28+
});
29+
30+
const kernelBrowser = await client.browsers.create();
31+
32+
console.log(`Live view url: ${kernelBrowser.browser_live_view_url}`);
33+
```
34+
35+
### 3. Update your browser configuration
36+
37+
Replace your existing browser setup to use Kernel's CDP URL and display settings:
38+
39+
```typescript
40+
const agent = await startBrowserAgent({
41+
url: 'https://magnitasks.com',
42+
narrate: true,
43+
browser: {
44+
cdp: kernelBrowser.cdp_ws_url,
45+
contextOptions: {
46+
viewport: { width: 1024, height: 768 }
47+
}
48+
},
49+
virtualScreenDimensions: { width: 1024, height: 768 },
50+
llm: {
51+
provider: 'anthropic',
52+
options: {
53+
model: 'claude-sonnet-4-20250514'
54+
}
55+
}
56+
});
57+
```
58+
59+
### 4. Use your agent
60+
61+
Use Magnitude's agent methods with the Kernel-powered browser:
62+
63+
```typescript
64+
await agent.act([
65+
'click on "Tasks" in the sidebar',
66+
'click on the first item in the "In Progress" column'
67+
]);
68+
69+
const assignee = await agent.extract('Extract the task Assignee', z.string());
70+
71+
await agent.stop();
72+
73+
// Clean up the Kernel Browser Session
74+
await client.browsers.deleteByID(kernelBrowser.session_id);
75+
```
76+
77+
## Quick setup with our Magnitude example app
78+
79+
Alternatively, you can use our Kernel app template that includes a pre-configured Magnitude integration:
80+
81+
```bash
82+
npx @onkernel/create-kernel-app my-magnitude-app
83+
```
84+
85+
Choose `TypeScript` as the programming language and then select `Magnitude` as the template.
86+
87+
Then follow the [Quickstart guide](/quickstart/) to deploy and run your Magnitude automation on Kernel's infrastructure.
88+
89+
## Benefits of using Kernel with Magnitude
90+
91+
- **No local browser management**: Run automations without installing or maintaining browsers locally
92+
- **Scalability**: Launch multiple browser sessions in parallel
93+
- **Stealth mode**: Built-in anti-detection features for web scraping
94+
- **Session persistence**: Maintain browser state across automation runs
95+
- **Live view**: Debug your automations with real-time browser viewing
96+
97+
## Next steps
98+
99+
- Check out [live view](/browsers/live-view) for debugging your automations
100+
- Learn about [stealth mode](/browsers/stealth) for avoiding detection
101+
- Learn how to properly [terminate browser sessions](/browsers/termination)
102+
- Learn how to [deploy](/apps/deploy) your Magnitude app to Kernel
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<CodeGroup>
2+
```typescript Typescript/Javascript
3+
import Kernel from '@onkernel/sdk';
4+
5+
const client = new Kernel({
6+
apiKey: 'My API Key',
7+
});
8+
9+
// Automatically fetches more pages as needed.
10+
for await (const invocationListResponse of client.invocations.list()) {
11+
console.log(invocationListResponse.id);
12+
}
13+
```
14+
15+
16+
```python Python
17+
from kernel import Kernel
18+
19+
client = Kernel(
20+
api_key="My API Key",
21+
)
22+
page = client.invocations.list()
23+
page = page.items[0]
24+
print(page.id)
25+
```
26+
</CodeGroup>

0 commit comments

Comments
 (0)