You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 49902a6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: pkg/templates/typescript/stagehand/README.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,19 @@
1
-
# Kernel TypeScript Sample App - Stagehand
1
+
# Kernel TypeScript Sample App - Stagehand (v4)
2
2
3
-
A Stagehand-powered browser automation app that extracts team size information from Y Combinator company pages.
3
+
A [Stagehand v4](https://docs.stagehand.dev)browser automation app that extracts team size information from Y Combinator company pages, running against a Kernel cloud browser.
4
4
5
5
## What it does
6
6
7
7
The `teamsize-task` searches for a startup on Y Combinator's company directory and extracts the team size (number of employees).
8
8
9
+
## How Stagehand v4 connects to a Kernel browser
10
+
11
+
Stagehand v4 no longer drives the browser purely over CDP — it runs as a **Chrome extension** next to the browser. To use it with a remote Kernel browser, this template:
12
+
13
+
1. Creates a Kernel browser.
14
+
2. Uploads the Stagehand extension (shipped inside the `@browserbasehq/stagehand` package) onto the running browser's filesystem, at the path Stagehand loads it from.
15
+
3. Connects with `localBrowser.connect({ cdpUrl })` — with no `extensionId`, Stagehand loads the extension into the running browser over CDP (`Extensions.loadUnpacked`) — and `Stagehand.create({ browser })`.
16
+
9
17
## Input
10
18
11
19
```json
@@ -24,12 +32,15 @@ The `teamsize-task` searches for a startup on Y Combinator's company directory a
24
32
25
33
## Setup
26
34
27
-
Create a `.env` file:
35
+
Create a `.env` file with a provider-prefixed `MODEL` and its API key:
28
36
29
37
```
30
-
OPENAI_API_KEY=your-openai-api-key
38
+
MODEL=anthropic/claude-sonnet-4-5
39
+
MODEL_API_KEY=your-api-key
31
40
```
32
41
42
+
`MODEL` can be any provider Stagehand supports, e.g. `openai/gpt-4.1` or `google/gemini-2.5-flash`.
0 commit comments