Skip to content

Commit 6e15de9

Browse files
authored
[GRO-1938] feat: Add Browserbase Eve extension (#88)
* Add Browserbase Eve extension * Fix Eve session lifecycle handling * Serialize Eve browser session access * Harden Eve Stagehand session cleanup * Flatten Eve session recovery metadata * Release Eve browser sessions through Browserbase * Simplify Eve session lifecycle * refactor: move eve extension into packages
1 parent e4a3844 commit 6e15de9

32 files changed

Lines changed: 844 additions & 1 deletion

examples/integrations/vercel/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ Browserbase is a perfect addition to the Vercel AI SDK, bringing headless browse
1414

1515
## Examples
1616

17-
In this directory we have two examples of using Vercel & Browserbase together:
17+
In this directory we have three examples of using Vercel & Browserbase together:
1818

1919
BrowseGPT is a chat interface that allows users to search the web and get answers to their questions. It demonstrates how to use Vercel AI SDK with Browserbase to create an AI assistant that can browse the web in real-time to provide up-to-date information.
2020

2121
The second example shows how to use Puppeteer with Vercel on Fluid Compute. It demonstrates setting up a Next.js application with Puppeteer for browser automation tasks, deployed on Vercel's Fluid Compute infrastructure which provides longer execution times needed for browser automation.
22+
23+
The [`@browserbasehq/eve`](../../../packages/eve-browserbase/) package gives Eve
24+
agents a persistent Browserbase browser through Stagehand's `act`, `observe`,
25+
`extract`, and autonomous agent primitives. The
26+
[example agent](./eve-example/) mounts the extension in a runnable pnpm
27+
workspace.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BROWSERBASE_API_KEY=bb_live_...
2+
AI_GATEWAY_API_KEY=your_vercel_ai_gateway_key
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
.env*
3+
!.env.example
4+
.eve
5+
.vercel
6+
.output
7+
.nitro
8+
dist
9+
*.tsbuildinfo
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.16.0
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Example Eve browser agent
2+
3+
This agent mounts the local `@browserbasehq/eve` extension as `browserbase`, so
4+
its tools are available as `browserbase__create_session`,
5+
`browserbase__navigate`, `browserbase__observe`, `browserbase__act`,
6+
`browserbase__extract`, `browserbase__agent`, and
7+
`browserbase__stop_session`. It also exposes `browserbase__search` and
8+
`browserbase__fetch`, which do not require a browser session.
9+
10+
## Run it
11+
12+
From the repository root, enter the `eve` package directory:
13+
14+
```bash
15+
cd packages/eve-browserbase
16+
nvm use
17+
pnpm install
18+
pnpm build
19+
cp ../../examples/integrations/vercel/eve-example/.env.example ../../examples/integrations/vercel/eve-example/.env
20+
```
21+
22+
Fill in the values in `../../examples/integrations/vercel/eve-example/.env`,
23+
then start the agent from the same `packages/eve-browserbase` directory:
24+
25+
```bash
26+
pnpm --filter browserbase-eve-example dev
27+
```
28+
29+
Eve requires Node.js 24 or newer. Both workspace packages include an `.nvmrc`
30+
for Node 24.16.0. If that version is not installed yet, run
31+
`nvm install 24.16.0` before `nvm use`.
32+
33+
The Eve terminal UI opens. Try this prompt:
34+
35+
```text
36+
Open https://news.ycombinator.com and return the titles and URLs of the first
37+
five stories. Use a Browserbase session and stop it when you are done.
38+
```
39+
40+
The environment requires:
41+
42+
- `BROWSERBASE_API_KEY` to create the cloud browser and power Stagehand through
43+
Browserbase Model Gateway.
44+
- `AI_GATEWAY_API_KEY` to power the Eve agent model. A linked Vercel project's
45+
`VERCEL_OIDC_TOKEN` can be used instead.
46+
47+
The dependency on `@browserbasehq/eve` uses pnpm's `workspace:*` protocol, so
48+
the example exercises the local package without publishing it first. The
49+
workspace-level install provides dependencies for both packages.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineAgent } from 'eve';
2+
3+
export default defineAgent({
4+
model: 'openai/gpt-5.4-mini',
5+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import browserbase from '@browserbasehq/eve';
2+
3+
export default browserbase({
4+
apiKey: process.env.BROWSERBASE_API_KEY!,
5+
model: 'openai/gpt-5.4-mini',
6+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Identity
2+
3+
You are a browser research agent. Use the Browserbase extension whenever a task
4+
requires opening or interacting with a website.
5+
6+
# Browser workflow
7+
8+
1. Use Browserbase Search when you need to discover relevant URLs.
9+
2. Use Browserbase Fetch when you only need page content and the page does not
10+
require JavaScript or interaction.
11+
3. For interactive or rendered pages, create a Browserbase session and navigate
12+
to the requested URL.
13+
4. Use observe before interacting with an unfamiliar page.
14+
5. Prefer act for one interaction and extract for structured results.
15+
6. Use the autonomous agent tool only for genuinely multi-step browser work.
16+
7. Stop any Browserbase session before returning the final answer.
17+
18+
Never invent page contents. Report a browser failure clearly if a tool cannot
19+
complete the requested operation.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "browserbase-eve-example",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"packageManager": "pnpm@10.9.0",
7+
"scripts": {
8+
"build": "eve build",
9+
"dev": "eve dev",
10+
"start": "eve start",
11+
"typecheck": "tsc"
12+
},
13+
"dependencies": {
14+
"@browserbasehq/eve": "workspace:*",
15+
"ai": "^7.0.26",
16+
"eve": "0.25.3",
17+
"zod": "4.4.3"
18+
},
19+
"devDependencies": {
20+
"@types/node": "24.10.1",
21+
"typescript": "7.0.2"
22+
},
23+
"overrides": {
24+
"ai": "^7.0.26"
25+
},
26+
"engines": {
27+
"node": ">=24"
28+
}
29+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2022",
4+
"module": "esnext",
5+
"moduleResolution": "bundler",
6+
"types": ["node"],
7+
"strict": true,
8+
"esModuleInterop": true,
9+
"skipLibCheck": true,
10+
"noEmit": true
11+
},
12+
"include": ["agent/**/*.ts"]
13+
}

0 commit comments

Comments
 (0)