Skip to content

Commit 2d3fcef

Browse files
dprevoznikcursoragenttembo[bot]
authored
Claude agent sdk integration (#159)
* Add Claude Agent SDK integration documentation Co-authored-by: danny <[email protected]> * Refactor: Update Claude Agent SDK integration documentation Co-authored-by: danny <[email protected]> * Update api keys links in dashboard * Use code groups instead of tabs for code snippets. * Update integrations/overview.mdx Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com> * docs: remove explicit app name from claude-agent-sdk template command (#160) Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com> * Update Claude Code Installation instructions match instructions in claude code docs + pnpm instead of npm --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
1 parent 2ae414b commit 2d3fcef

File tree

4 files changed

+151
-1
lines changed

4 files changed

+151
-1
lines changed

browsers/bot-detection/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Emulates native keyboard and mouse input directly at the OS level.
4545

4646
Before you start automating your workflow, we recommend that you manually test your website to understand how it behaves with Kernel's browsers. Here's how to do that:
4747

48-
1. **Launch a browser from the [Kernel dashboard](https://www.dashboard.onkernel.com/browsers).** This opens a Kernel browser instance in a clean virtual machine.
48+
1. **Launch a browser from the [Kernel dashboard](https://dashboard.onkernel.com/browsers).** This opens a Kernel browser instance in a clean virtual machine.
4949
2. **Navigate to the target website** and perform the same actions you plan to automate — logging in, filling forms, loading dashboards, etc.
5050
3. **Observe potential friction points:**
5151
- Are you immediately prompted for CAPTCHA or MFA?

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"pages": [
133133
"integrations/overview",
134134
"integrations/browser-use",
135+
"integrations/claude-agent-sdk",
135136
{
136137
"group": "Computer Use",
137138
"pages": [

integrations/claude-agent-sdk.mdx

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
title: "Claude Agent SDK"
3+
---
4+
5+
The [Claude Agent SDK](https://platform.claude.com/docs/en/agent-sdk/overview) provides a powerful way to build AI agents that can autonomously perform tasks. By integrating the Claude Agent SDK with Kernel, you can create agents that browse the web and interact with websites using cloud-hosted browser infrastructure.
6+
7+
This integration combines Claude's agent capabilities with Kernel's Playwright Execution API to enable browser automation without managing local browser infrastructure.
8+
9+
## Quick setup with Claude Agent SDK
10+
11+
Get started with Claude Agent SDK and Kernel using our pre-configured app template:
12+
13+
```bash
14+
kernel create --template claude-agent-sdk
15+
```
16+
17+
Choose `TypeScript` or `Python` as the programming language.
18+
19+
Then follow the [Quickstart guide](/quickstart/) to deploy and run your Claude Agent SDK automation on Kernel's infrastructure.
20+
21+
## Prerequisites
22+
23+
### Claude Code Installation
24+
25+
The Claude Agent SDK requires Claude Code to be installed. Choose one of the following methods:
26+
27+
```bash
28+
# Homebrew (macOS)
29+
brew install --cask claude-code
30+
31+
# pnpm (cross-platform)
32+
pnpm add -g @anthropic-ai/claude-code
33+
34+
# macOS/Linux/WSL
35+
curl -fsSL https://claude.ai/install.sh | bash
36+
```
37+
38+
See the [official installation guide](https://platform.claude.com/docs/en/agent-sdk/overview#get-started) for Windows and other options.
39+
40+
<Note>
41+
When deploying to Kernel, the app automatically installs Claude Code on the remote infrastructure.
42+
</Note>
43+
44+
### API Keys
45+
46+
You'll need:
47+
- **ANTHROPIC_API_KEY**: Get from the [Anthropic Console](https://console.anthropic.com/)
48+
- **KERNEL_API_KEY**: Get from the [Kernel Dashboard](https://dashboard.onkernel.com/api-keys)
49+
50+
## Running locally
51+
52+
<CodeGroup>
53+
```bash TypeScript
54+
# Install dependencies
55+
pnpm install
56+
57+
# Set up environment variables
58+
cp .env.example .env
59+
# Edit .env with your API keys
60+
61+
# Run with default task
62+
pnpm exec tsx index.ts
63+
64+
# Run with custom task
65+
pnpm exec tsx index.ts "Go to duckduckgo.com and search for 'Kernel browser automation'"
66+
```
67+
68+
```bash Python
69+
# Install dependencies
70+
uv sync
71+
72+
# Set up environment variables
73+
cp .env.example .env
74+
# Edit .env with your API keys
75+
76+
# Run with default task
77+
uv run main.py
78+
79+
# Run with custom task
80+
uv run main.py "Go to duckduckgo.com and search for 'Kernel browser automation'"
81+
```
82+
</CodeGroup>
83+
84+
## Deploying to Kernel
85+
86+
Deploy and invoke the app on Kernel's infrastructure:
87+
88+
<CodeGroup>
89+
```bash TypeScript
90+
# Login to Kernel
91+
kernel login
92+
93+
# Deploy the app with environment variables
94+
kernel deploy index.ts --env-file .env
95+
96+
# Invoke the action (logs stream automatically)
97+
kernel invoke ts-claude-agent-sdk agent-task -p '{"task": "Go to https://news.ycombinator.com and get the top 3 stories"}'
98+
```
99+
100+
```bash Python
101+
# Login to Kernel
102+
kernel login
103+
104+
# Deploy the app with environment variables
105+
kernel deploy main.py --env-file .env
106+
107+
# Invoke the action (logs stream automatically)
108+
kernel invoke py-claude-agent-sdk agent-task -p '{"task": "Go to https://news.ycombinator.com and get the top 3 stories"}'
109+
```
110+
</CodeGroup>
111+
112+
## How it works
113+
114+
1. **Browser Creation**: A Kernel browser session is created with stealth mode enabled
115+
2. **MCP Server**: An in-process MCP server is created with an `execute_playwright` tool
116+
3. **Agent Execution**: The Claude Agent SDK runs with access to the Playwright tool
117+
4. **Task Completion**: Claude autonomously uses the tool to complete the given task
118+
5. **Cleanup**: The browser session is deleted when done
119+
120+
## Example tasks
121+
122+
```bash
123+
# Get top Hacker News stories
124+
"Go to https://news.ycombinator.com and tell me the top 3 stories"
125+
126+
# Search for something
127+
"Go to duckduckgo.com and search for 'Kernel browser automation'"
128+
129+
# Extract data from a page
130+
"Go to https://github.com/trending and list the top 5 trending repositories"
131+
```
132+
133+
## Benefits of using Kernel with Claude Agent SDK
134+
135+
- **No local browser management**: Run Claude Agent SDK automations without installing or maintaining browsers locally
136+
- **Scalability**: Launch multiple browser sessions in parallel for concurrent AI agents
137+
- **Stealth mode**: Built-in anti-detection features for reliable web interactions
138+
- **Session state**: Maintain browser state across runs via [Profiles](/browsers/profiles)
139+
- **Live view**: Debug your Claude agents with real-time browser viewing
140+
- **Cloud infrastructure**: Run computationally intensive AI agents without local resource constraints
141+
142+
## Next steps
143+
144+
- Check out [live view](/browsers/live-view) for debugging your Claude Agent SDK automations
145+
- Learn about [stealth mode](/browsers/bot-detection/stealth) for avoiding detection
146+
- Learn about [Playwright Execution](/browsers/playwright-execution) for running Playwright code in the browser VM
147+
- Learn how to properly [terminate browser sessions](/browsers/termination)
148+
- Learn how to [deploy](/apps/deploy) your Claude Agent SDK app to Kernel

integrations/overview.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Kernel browsers work with any framework or tool that supports the Chrome DevTool
1818
Kernel provides detailed guides for popular agent frameworks:
1919

2020
- **[Browser Use](/integrations/browser-use)** - AI browser agent framework
21+
- **[Claude Agent SDK](/integrations/claude-agent-sdk)** - Run Claude Agent SDK automations in cloud browsers
2122
- **[Stagehand](/integrations/stagehand)** - AI browser automation with natural language
2223
- **[Computer Use (Anthropic)](/integrations/computer-use/anthropic)** - Claude's computer use capability
2324
- **[Computer Use (OpenAI)](/integrations/computer-use/openai)** - OpenAI's computer use capability

0 commit comments

Comments
 (0)