Skip to content
Merged
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
1 change: 0 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ browse status
|----------|-------------|
| `BROWSE_SESSION` | Default session name (alternative to `--session`) |
| `BROWSERBASE_API_KEY` | Browserbase API key (required for `browse env remote`) |
| `BROWSERBASE_PROJECT_ID` | Browserbase project ID (optional, passed through if set) |

## Element References

Expand Down
6 changes: 3 additions & 3 deletions packages/docs/v3/basics/agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ await agent.execute({
const agent = stagehand.agent({
mode: "cua",
model: {
modelName: "anthropic/claude-sonnet-4-20250514",
modelName: "anthropic/claude-sonnet-4-6",
apiKey: process.env.ANTHROPIC_API_KEY
},
systemPrompt: "You are a helpful assistant...",
Expand Down Expand Up @@ -138,7 +138,7 @@ Both DOM and CUA modes have their strengths and weaknesses. Hybrid mode combines
<Warning>
**Model Requirements:** Hybrid mode requires models that can reliably perform coordinate-based actions from screenshots. The following models are recommended:
- **Google:** `google/gemini-3-flash-preview`
- **Anthropic:** `anthropic/claude-sonnet-4-20250514`, `anthropic/claude-sonnet-4-5-20250929`, `anthropic/claude-haiku-4-5-20251001`
- **Anthropic:** `anthropic/claude-sonnet-4-6`, `anthropic/claude-sonnet-4-5-20250929`, `anthropic/claude-haiku-4-5-20251001`

Other models may not reliably produce accurate coordinates for clicking and typing.

Expand Down Expand Up @@ -289,7 +289,7 @@ import { z } from "zod";

const agent = stagehand.agent({
mode: "cua",
model: "anthropic/claude-sonnet-4-20250514",
model: "anthropic/claude-sonnet-4-6",
tools: {
searchDatabase: tool({
description: 'Search for records in the database',
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/v3/best-practices/agent-fallbacks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ try {
console.log("Agent fallback triggered");

const agent = stagehand.agent({
model: "anthropic/claude-sonnet-4-20250514",
model: "anthropic/claude-sonnet-4-6",
systemPrompt: "You are a helpful assistant that can use a web browser.",
});

Expand Down
5 changes: 2 additions & 3 deletions packages/docs/v3/best-practices/computer-use.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const stagehand = new Stagehand({
model: "google/gemini-2.5-flash",

browserbaseSessionCreateParams: {
projectId: process.env.BROWSERBASE_PROJECT_ID!,
browserSettings: {
blockAds: true,
viewport: {
Expand Down Expand Up @@ -134,7 +133,7 @@ await page.goto("https://www.google.com/");
const agent = stagehand.agent({
mode: "cua",
model: {
modelName: "anthropic/claude-sonnet-4-20250514",
modelName: "anthropic/claude-sonnet-4-6",
apiKey: process.env.ANTHROPIC_API_KEY
},
systemPrompt: "You are a helpful assistant...",
Expand Down Expand Up @@ -175,7 +174,7 @@ const agent = stagehand.agent({
```typescript
const agent = stagehand.agent({
mode: "cua",
model: "anthropic/claude-sonnet-4-20250514",
model: "anthropic/claude-sonnet-4-6",
// ANTHROPIC_API_KEY is auto-loaded - set in your .env
});
```
Expand Down
3 changes: 0 additions & 3 deletions packages/docs/v3/best-practices/deployments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ export default async function handler(req: VercelRequest, res: VercelResponse):
const stagehand = new Stagehand({
env: "BROWSERBASE",
apiKey: process.env.BROWSERBASE_API_KEY!,
projectId: process.env.BROWSERBASE_PROJECT_ID!,
disablePino: true,
model: {
modelName: "google/gemini-2.5-flash",
apiKey: process.env.GOOGLE_API_KEY!,
},
// optional session params
browserbaseSessionCreateParams: {
projectId: process.env.BROWSERBASE_PROJECT_ID!,
region: "us-west-2",
browserSettings: {
blockAds: true,
Expand Down Expand Up @@ -169,7 +167,6 @@ Do not commit `.env` in production. Add variables via Vercel CLI:

```bash
vercel env add BROWSERBASE_API_KEY
vercel env add BROWSERBASE_PROJECT_ID
# (and your model key if needed)
vercel env add GOOGLE_API_KEY
```
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/v3/best-practices/deterministic-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ async function executeWithFallback() {
await page.goto("https://example.com");

const agent = stagehand.agent({
model: "anthropic/claude-sonnet-4-20250514"
model: "anthropic/claude-sonnet-4-6"
});

try {
Expand Down
11 changes: 3 additions & 8 deletions packages/docs/v3/configuration/browser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ Before getting started, set up the required environment variables:
<CodeGroup>
```bash .env
BROWSERBASE_API_KEY=your_api_key_here
BROWSERBASE_PROJECT_ID=your_project_id_here
```
</CodeGroup>

<Tip>
Get your API key and Project ID from the [Browserbase Dashboard](https://browserbase.com/overview)
Get your API key from the [Browserbase Dashboard](https://browserbase.com/overview)
</Tip>

### Using Stagehand with Browserbase
Expand All @@ -110,9 +109,8 @@ import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
env: "BROWSERBASE",
// Optional: API Key and Project ID will be pulled directly from your environment
// Optional: API Key will be pulled directly from your environment
apiKey: process.env.BROWSERBASE_API_KEY,
projectId: process.env.BROWSERBASE_PROJECT_ID,
browserbaseSessionCreateParams: {
proxies: true,
region: "us-west-2",
Expand All @@ -132,9 +130,7 @@ console.log("Session ID:", stagehand.sessionId);
const stagehand = new Stagehand({
env: "BROWSERBASE",
apiKey: process.env.BROWSERBASE_API_KEY,
projectId: process.env.BROWSERBASE_PROJECT_ID,
browserbaseSessionCreateParams: {
projectId: process.env.BROWSERBASE_PROJECT_ID!,
proxies: true,
region: "us-west-2",
timeout: 3600, // 1 hour session timeout
Expand Down Expand Up @@ -170,7 +166,6 @@ const bb = new Browserbase({
});

const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
// Add configuration options here
});
```
Expand Down Expand Up @@ -399,7 +394,7 @@ Setting `domSettleTimeout` too low may cause actions to fail on elements that ar

<AccordionGroup>
<Accordion title="Browserbase Authentication Errors">
- Verify your `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID` are set correctly
- Verify your `BROWSERBASE_API_KEY` is set correctly
- Check that your API key has the necessary permissions
- Ensure your Browserbase account has sufficient credits
</Accordion>
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/v3/first-steps/ai-rules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ For more advanced scenarios using computer-use models:
```typescript
const agent = stagehand.agent({
mode: "cua", // Enable Computer Use Agent mode
model: "anthropic/claude-sonnet-4-20250514",
model: "anthropic/claude-sonnet-4-6",
// or "google/gemini-2.5-computer-use-preview-10-2025"
systemPrompt: `You are a helpful assistant that can use a web browser.
Do not ask follow up questions, the user will trust your judgement.`,
Expand Down
1 change: 0 additions & 1 deletion packages/docs/v3/first-steps/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Set environment variables (or a `.env` via your framework):
```bash Bash
OPENAI_API_KEY=your_api_key
BROWSERBASE_API_KEY=your_api_key
BROWSERBASE_PROJECT_ID=your_project_id
```
</CodeGroup>

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/v3/first-steps/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ main().catch((err) => {
</CodeGroup>

<Tip>
To use, set provider keys in `.env` (e.g., `OPENAI_API_KEY`). For cloud browsers, add `BROWSERBASE_API_KEY` and `BROWSERBASE_PROJECT_ID`.
To use, set provider keys in `.env` (e.g., `OPENAI_API_KEY`). For cloud browsers, add `BROWSERBASE_API_KEY`.
</Tip>

## Next steps
Expand Down
3 changes: 0 additions & 3 deletions packages/docs/v3/integrations/convex/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Set the following environment variables in your [Convex Dashboard](https://dashb
| Variable | Description |
|----------|-------------|
| `BROWSERBASE_API_KEY` | Your Browserbase API key |
| `BROWSERBASE_PROJECT_ID` | Your Browserbase project ID |
| `MODEL_API_KEY` | API key for your LLM provider (OpenAI, Anthropic, etc.) |

## Basic Usage
Expand All @@ -63,7 +62,6 @@ import { z } from "zod";

const stagehand = new Stagehand(components.stagehand, {
browserbaseApiKey: process.env.BROWSERBASE_API_KEY!,
browserbaseProjectId: process.env.BROWSERBASE_PROJECT_ID!,
modelApiKey: process.env.MODEL_API_KEY!,
});
```
Expand Down Expand Up @@ -188,7 +186,6 @@ The default model is `openai/gpt-4o`. You can configure alternative providers:
```typescript
const stagehand = new Stagehand(components.stagehand, {
browserbaseApiKey: process.env.BROWSERBASE_API_KEY!,
browserbaseProjectId: process.env.BROWSERBASE_PROJECT_ID!,
modelApiKey: process.env.ANTHROPIC_API_KEY!,
modelName: "anthropic/claude-sonnet-4-5-20250929",
});
Expand Down
6 changes: 1 addition & 5 deletions packages/docs/v3/integrations/crew-ai/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ pip install stagehand crewai crewai-tools

You'll need API keys from three services:

1. **Browserbase API Key and Project ID**: Get these from your [Browserbase dashboard](https://www.browserbase.com/)
1. **Browserbase API Key**: Get this from your [Browserbase dashboard](https://www.browserbase.com/)
2. **LLM API Key**: Get an API key from [OpenAI](https://platform.openai.com/api-keys) or [Anthropic](https://console.anthropic.com/)

Store your API keys securely as environment variables:

```bash
BROWSERBASE_API_KEY="your-browserbase-api-key"
BROWSERBASE_PROJECT_ID="your-browserbase-project-id"
OPENAI_API_KEY="your-openai-api-key"
ANTHROPIC_API_KEY="your-anthropic-api-key"
```
Expand All @@ -46,13 +45,11 @@ from stagehand.schemas import AvailableModel

# Get API keys from environment
browserbase_api_key = os.environ.get("BROWSERBASE_API_KEY")
browserbase_project_id = os.environ.get("BROWSERBASE_PROJECT_ID")
model_api_key = os.environ.get("OPENAI_API_KEY") # or ANTHROPIC_API_KEY

# Initialize the StagehandTool
stagehand_tool = StagehandTool(
api_key=browserbase_api_key,
project_id=browserbase_project_id,
model_api_key=model_api_key,
model_name=AvailableModel.GPT_4O, # or AvailableModel.CLAUDE_3_7_SONNET_LATEST
)
Expand Down Expand Up @@ -108,7 +105,6 @@ Customize the StagehandTool behavior with additional parameters:
```python
stagehand_tool = StagehandTool(
api_key=browserbase_api_key,
project_id=browserbase_project_id,
model_api_key=model_api_key,
model_name=AvailableModel.CLAUDE_3_7_SONNET_LATEST,
dom_settle_timeout_ms=5000, # Wait longer for DOM to settle
Expand Down
1 change: 0 additions & 1 deletion packages/docs/v3/integrations/langchain/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ For remote browser automation, set up your Browserbase credentials:

```bash
BROWSERBASE_API_KEY="your-browserbase-api-key"
BROWSERBASE_PROJECT_ID="your-browserbase-project-id"
```

## Step 3: Create a Stagehand Instance
Expand Down
23 changes: 3 additions & 20 deletions packages/docs/v3/integrations/mcp/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ Command-line flags are only available when running the server locally (`npx @bro

Configure the essential Browserbase credentials and optional debugging settings:

<CardGroup cols={2}>
<Card title="BROWSERBASE_API_KEY" icon="key">
Your Browserbase API key for authentication
</Card>

<Card title="BROWSERBASE_PROJECT_ID" icon="key">
Your Browserbase project ID
</Card>

</CardGroup>

## Command-Line Flags

### Available Flags
Expand Down Expand Up @@ -83,7 +76,6 @@ When using our remote hosted server, we provide the LLM costs for Gemini, the [b
"args": ["@browserbasehq/mcp"],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand All @@ -101,7 +93,6 @@ When using our remote hosted server, we provide the LLM costs for Gemini, the [b
"args": ["/path/to/mcp-server-browserbase/cli.js"],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand All @@ -123,7 +114,6 @@ node cli.js --port 8931
"url": "http://localhost:8931/mcp",
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand Down Expand Up @@ -151,7 +141,6 @@ Enable Browserbase proxies for IP rotation and geo-location testing.
"args": ["@browserbasehq/mcp", "--proxies"],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand All @@ -177,7 +166,6 @@ Enable advanced anti-detection features for enhanced stealth browsing.
"args": ["@browserbasehq/mcp", "--advancedStealth"],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand All @@ -200,8 +188,7 @@ Use persistent browser contexts to maintain authentication and state across sess
"command": "npx",
"args": ["@browserbasehq/mcp", "--contextId", "your_context_id"],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id"
"BROWSERBASE_API_KEY": "your_api_key"
}
}
}
Expand All @@ -228,7 +215,6 @@ Customize browser window dimensions. Default is 1288x711. Recommended aspect rat
],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand Down Expand Up @@ -285,8 +271,7 @@ When using any custom model (non-default), you must provide your own API key for
"--modelApiKey", "your_openai_api_key"
],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id"
"BROWSERBASE_API_KEY": "your_api_key"
}
}
}
Expand All @@ -304,8 +289,7 @@ When using any custom model (non-default), you must provide your own API key for
"--modelApiKey", "your_anthropic_api_key"
],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id"
"BROWSERBASE_API_KEY": "your_api_key"
}
}
}
Expand Down Expand Up @@ -333,7 +317,6 @@ Configure custom host and port for SHTTP transport.
],
"env": {
"BROWSERBASE_API_KEY": "your_api_key",
"BROWSERBASE_PROJECT_ID": "your_project_id",
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/docs/v3/integrations/playwright.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ When using Browserbase, set your credentials:

```bash
BROWSERBASE_API_KEY=your_api_key
BROWSERBASE_PROJECT_ID=your_project_id
```

For OpenAI (or other providers):
Expand Down
1 change: 0 additions & 1 deletion packages/docs/v3/integrations/puppeteer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ When using Browserbase, set your credentials:

```bash
BROWSERBASE_API_KEY=your_api_key
BROWSERBASE_PROJECT_ID=your_project_id
```

For OpenAI (or other providers):
Expand Down
4 changes: 1 addition & 3 deletions packages/docs/v3/integrations/selenium.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ const bb = new Browserbase({
});

// Create shared session
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID,
});
const session = await bb.sessions.create({});

console.log("Session created:", session.id);
```
Expand Down
Loading
Loading