Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions examples/integrations/n8n/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Node modules
/node_modules

# Docker
docker-compose.yml
Dockerfile
.dockerignore
51 changes: 51 additions & 0 deletions examples/integrations/n8n/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = {
/**
* https://prettier.io/docs/en/options.html#semicolons
*/
semi: true,

/**
* https://prettier.io/docs/en/options.html#trailing-commas
*/
trailingComma: 'all',

/**
* https://prettier.io/docs/en/options.html#bracket-spacing
*/
bracketSpacing: true,

/**
* https://prettier.io/docs/en/options.html#tabs
*/
useTabs: true,

/**
* https://prettier.io/docs/en/options.html#tab-width
*/
tabWidth: 2,

/**
* https://prettier.io/docs/en/options.html#arrow-function-parentheses
*/
arrowParens: 'always',

/**
* https://prettier.io/docs/en/options.html#quotes
*/
singleQuote: true,

/**
* https://prettier.io/docs/en/options.html#quote-props
*/
quoteProps: 'as-needed',

/**
* https://prettier.io/docs/en/options.html#end-of-line
*/
endOfLine: 'lf',

/**
* https://prettier.io/docs/en/options.html#print-width
*/
printWidth: 100,
};
38 changes: 38 additions & 0 deletions examples/integrations/n8n/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### 1.0.0

- chore(deps):(deps-dev): bump @types/node from 24.10.9 to 25.0.9 [`#43`](https://github.com/browserbase/integrations/pull/43)
- [integration]: first version of cartesia line form fill integration [`#25`](https://github.com/browserbase/integrations/pull/25)
- chore(deps):(deps-dev): bump vitest from 2.1.9 to 4.0.6 [`#38`](https://github.com/browserbase/integrations/pull/38)
- fix: update mastra integration tools and versioning [`#36`](https://github.com/browserbase/integrations/pull/36)
- [GRO-227]: add python version of integration to mongodb [`#22`](https://github.com/browserbase/integrations/pull/22)
- chore(deps):(deps-dev): bump eslint-config-prettier from 9.1.2 to 10.1.8 [`#27`](https://github.com/browserbase/integrations/pull/27)
- chore: Add Claude Code GitHub Workflow [`#32`](https://github.com/browserbase/integrations/pull/32)
- chore(deps):(deps-dev): bump @types/node from 22.18.1 to 24.3.1 [`#31`](https://github.com/browserbase/integrations/pull/31)
- chore(deps):(deps-dev): bump globals from 15.15.0 to 16.3.0 [`#30`](https://github.com/browserbase/integrations/pull/30)
- [GRO-257] flags for advanced stealth and proxies, set default model [`#23`](https://github.com/browserbase/integrations/pull/23)
- working with the latest version of browser-use [`#21`](https://github.com/browserbase/integrations/pull/21)
- [Integration]: Temporal x Stagehand [`#11`](https://github.com/browserbase/integrations/pull/11)
- fix stagehand crew ai example code + add requirements file [`#19`](https://github.com/browserbase/integrations/pull/19)
- browser-use deps + env example [`#18`](https://github.com/browserbase/integrations/pull/18)
- [Fix]: Fix Next and Python CVEs [`#17`](https://github.com/browserbase/integrations/pull/17)
- trigger.dev integration [`#15`](https://github.com/browserbase/integrations/pull/15)
- add node and python readmes for stripe [`#14`](https://github.com/browserbase/integrations/pull/14)
- Initial commit [`#13`](https://github.com/browserbase/integrations/pull/13)
- [Fix]: Fix CVEs [`#9`](https://github.com/browserbase/integrations/pull/9)
- portia integration [`#8`](https://github.com/browserbase/integrations/pull/8)
- adding mastra integration + docs [`#10`](https://github.com/browserbase/integrations/pull/10)
- [Integration]: add agno to integrations [`#6`](https://github.com/browserbase/integrations/pull/6)
- added langchain and crew ai stagehand integrations [`#5`](https://github.com/browserbase/integrations/pull/5)
- add mongodb integration [`#2`](https://github.com/browserbase/integrations/pull/2)
- added braintrust and agentkit readmes [`#1`](https://github.com/browserbase/integrations/pull/1)
- Initial commit [`#4`](https://github.com/browserbase/integrations/pull/4)
- Bump h11 in /examples/integrations/crewai/crewai-tutorial [`#3`](https://github.com/browserbase/integrations/pull/3)
- init [`33922e8`](https://github.com/browserbase/integrations/commit/33922e83e0b8bfb66b8924a194cd549467085d24)
- update to use http API version of community node [`1ee8e52`](https://github.com/browserbase/integrations/commit/1ee8e52e18c1a5e561867f7cd23aaaf98e368564)
- v0 of n8n nodes [`5330f95`](https://github.com/browserbase/integrations/commit/5330f95772bb2d1174cd870679960521cf4141cd)
155 changes: 155 additions & 0 deletions examples/integrations/n8n/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# n8n-nodes-browserbase

This is an n8n community node that lets you automate browsers using [Browserbase](https://browserbase.com) powered by [Stagehand](https://stagehand.dev) in your n8n workflows.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

## Development / Testing with Docker

```bash
# Install dependencies
npm install

# Build the node
npm run build

# Run n8n with your node in Docker
docker-compose up --build

# Open http://localhost:5678 and search for "Browserbase" node
```

To rebuild after changes:
```bash
npm run build && docker-compose up --build
```

## How It Works

The Browserbase Agent node is a single, self-contained node that:
1. Creates a browser session
2. Navigates to your starting URL
3. Executes an AI agent to complete your task
4. Closes the session automatically

Just provide a URL and an instruction - the node handles everything else.

## Configuration

### Required Fields

| Field | Description |
|-------|-------------|
| **Starting URL** | The page where the agent begins (e.g., `https://example.com`) |
| **Instruction** | Natural language task for the agent to complete |

### Driver Model

The driver model powers the browser session (navigation, DOM interactions). Choose from:

- `google/gemini-2.5-flash` (Recommended - fast & cheap)
- `google/gemini-2.5-pro`
- `openai/gpt-4o`
- `openai/gpt-4o-mini`
- `anthropic/claude-sonnet-4-5-20250929`

### Agent Mode

| Mode | Description | Best For |
|------|-------------|----------|
| **CUA** | Computer Use Agent - uses vision and coordinates | Complex UIs, visual interactions |
| **DOM** | Uses DOM selectors - works with any LLM | Speed, simple pages |
| **Hybrid** | Combines both approaches | Fallback reliability |

### Agent Models

Models available depend on the selected mode:

**CUA Mode:**
- `google/gemini-2.5-computer-use-preview-10-2025`
- `openai/computer-use-preview`
- `anthropic/claude-sonnet-4-20250514`
- `anthropic/claude-sonnet-4-5-20250929`
- `anthropic/claude-haiku-4-5-20251001`

**DOM Mode:**
- `google/gemini-2.5-flash`
- `google/gemini-2.5-pro`
- `openai/gpt-4o`
- `openai/gpt-4o-mini`
- `anthropic/claude-sonnet-4-5-20250929`

**Hybrid Mode:**
- `google/gemini-3-flash-preview`
- `anthropic/claude-sonnet-4-20250514`
- `anthropic/claude-haiku-4-5-20251001`

## Credentials

You need three credentials:

| Credential | Description |
|------------|-------------|
| **Browserbase API Key** | Your Browserbase API key |
| **Browserbase Project ID** | Your Browserbase project ID |
| **Model API Key** | API key for your chosen model provider |

> **Important:** The Model API Key must match the provider of your models. If using Google models, provide a Google API key. If using OpenAI, provide an OpenAI key.

### Getting Credentials

1. Sign up at [Browserbase](https://browserbase.com)
2. Navigate to your dashboard for API key and Project ID
3. Get an API key from your model provider:
- [Google AI Studio](https://aistudio.google.com/apikey)
- [OpenAI](https://platform.openai.com/api-keys)
- [Anthropic](https://console.anthropic.com/)

## Example Usage

**Simple extraction:**
- URL: `https://news.ycombinator.com`
- Instruction: `Find the top 3 stories and return their titles and URLs`

**Form filling:**
- URL: `https://example.com/contact`
- Instruction: `Fill out the contact form with name "John Doe" and email "john@example.com", then submit`

**Navigation + action:**
- URL: `https://github.com`
- Instruction: `Search for "stagehand" and click on the first repository result`

## Output

The node returns an `AgentResult` object:

```json
{
"success": true,
"message": "Task completed successfully",
"actions": [
{ "type": "act", "action": "clicked submit button" }
],
"completed": true,
"usage": {
"input_tokens": 1250,
"output_tokens": 340,
"inference_time_ms": 2500
},
"sessionId": "abc-123"
}
```

## Compatibility

Compatible with n8n@1.60.0 or later

## Resources

- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
- [Browserbase Documentation](https://docs.browserbase.com)
- [Stagehand Documentation](https://docs.stagehand.dev)
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';

export class BrowserbaseApi implements ICredentialType {
name = 'browserbaseApi';

displayName = 'Browserbase API';

documentationUrl = 'https://docs.browserbase.com';

icon = 'file:browserbase.svg' as const;

properties: INodeProperties[] = [
{
displayName: 'Browserbase API Key',
name: 'browserbaseApiKey',
type: 'string',
typeOptions: { password: true },
default: '',
required: true,
description: 'Your Browserbase API key',
},
{
displayName: 'Browserbase Project ID',
name: 'browserbaseProjectId',
type: 'string',
default: '',
required: true,
description: 'Your Browserbase project ID',
},
{
displayName: 'Model API Key',
name: 'modelApiKey',
type: 'string',
typeOptions: { password: true },
default: '',
required: true,
description: 'API key for the AI model (e.g., Gemini API key)',
},
];

authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'x-bb-api-key': '={{$credentials.browserbaseApiKey}}',
'x-bb-project-id': '={{$credentials.browserbaseProjectId}}',
'x-model-api-key': '={{$credentials.modelApiKey}}',
},
},
};

test: ICredentialTestRequest = {
request: {
baseURL: 'https://api.stagehand.browserbase.com',
url: '/v1/sessions/start',
method: 'POST',
body: {
modelName: 'openai/gpt-4o',
},
},
};
}
3 changes: 3 additions & 0 deletions examples/integrations/n8n/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { config } from '@n8n/node-cli/eslint';

export default config;
11 changes: 11 additions & 0 deletions examples/integrations/n8n/icons/browserbase.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/integrations/n8n/nodes/Browserbase/Browserbase.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"node": "n8n-nodes-browserbase",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Development", "Developer Tools"],
"resources": {
"primaryDocumentation": [
{
"url": "https://docs.browserbase.com"
}
]
}
}
Loading