From cfcd3d47aecf4edbef682b23f9372aaf1a135a81 Mon Sep 17 00:00:00 2001 From: Chromie Bot Date: Mon, 30 Mar 2026 06:54:22 +0000 Subject: [PATCH 1/3] docs: simplify model config in BROWSERBASE snippets to use string format When using Browserbase, apiKey is now optional for openai/google/anthropic providers. Replace model object `{ modelName, apiKey }` with simple string format `"provider/model"` to reduce friction in docs examples. Updated files: - best-practices/caching.mdx (1 instance) - best-practices/deployments.mdx (1 instance) - best-practices/deterministic-agent.mdx (4 instances) Co-Authored-By: Claude Opus 4.6 --- packages/docs/v3/best-practices/caching.mdx | 5 +---- .../docs/v3/best-practices/deployments.mdx | 5 +---- .../v3/best-practices/deterministic-agent.mdx | 20 ++++--------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/packages/docs/v3/best-practices/caching.mdx b/packages/docs/v3/best-practices/caching.mdx index e6f86b94b5..7c993ca57f 100644 --- a/packages/docs/v3/best-practices/caching.mdx +++ b/packages/docs/v3/best-practices/caching.mdx @@ -132,10 +132,7 @@ await page.goto("https://browserbase.github.io/stagehand-eval-sites/sites/drag-d const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "google/gemini-2.5-computer-use-preview-10-2025", - apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY - }, + model: "google/gemini-2.5-computer-use-preview-10-2025", systemPrompt: "You are a helpful assistant that can use a web browser.", }); diff --git a/packages/docs/v3/best-practices/deployments.mdx b/packages/docs/v3/best-practices/deployments.mdx index 46f3db0787..3aa4aff773 100644 --- a/packages/docs/v3/best-practices/deployments.mdx +++ b/packages/docs/v3/best-practices/deployments.mdx @@ -66,10 +66,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse): env: "BROWSERBASE", apiKey: process.env.BROWSERBASE_API_KEY!, disablePino: true, - model: { - modelName: "google/gemini-2.5-flash", - apiKey: process.env.GOOGLE_API_KEY!, - }, + model: "google/gemini-2.5-flash", // optional session params browserbaseSessionCreateParams: { region: "us-west-2", diff --git a/packages/docs/v3/best-practices/deterministic-agent.mdx b/packages/docs/v3/best-practices/deterministic-agent.mdx index 36bf6b0596..245ad2924f 100644 --- a/packages/docs/v3/best-practices/deterministic-agent.mdx +++ b/packages/docs/v3/best-practices/deterministic-agent.mdx @@ -62,10 +62,7 @@ await page.goto("https://example.com"); const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "google/gemini-2.5-computer-use-preview-10-2025", - apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY - }, + model: "google/gemini-2.5-computer-use-preview-10-2025", systemPrompt: "You are a helpful assistant that can use a web browser.", }); @@ -127,10 +124,7 @@ await page.goto("https://github.com"); const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "google/gemini-2.5-computer-use-preview-10-2025", - apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY - }, + model: "google/gemini-2.5-computer-use-preview-10-2025", systemPrompt: "You are a helpful assistant that can use a web browser.", }); @@ -174,10 +168,7 @@ await page.goto("https://github.com"); const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "google/gemini-2.5-computer-use-preview-10-2025", - apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY - }, + model: "google/gemini-2.5-computer-use-preview-10-2025", systemPrompt: "You are a helpful assistant that can use a web browser.", }); @@ -222,10 +213,7 @@ await page.goto("https://example.com"); const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "google/gemini-2.5-computer-use-preview-10-2025", - apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY - }, + model: "google/gemini-2.5-computer-use-preview-10-2025", systemPrompt: "You are a helpful assistant that can use a web browser.", }); From 0097bb464f1580b0aa2c4ee7a733acd321a981f3 Mon Sep 17 00:00:00 2001 From: Chromie Date: Sun, 5 Apr 2026 21:40:21 -0700 Subject: [PATCH 2/3] Chromie/fix basics model string format (#1962) # why # what changed # test plan --- ## Summary by cubic Update Basics docs to use the simple model string format ("provider/model") in code snippets for `act` and `agent`, replacing the verbose `{ modelName, apiKey }` form. Aligns these pages with our best-practices examples; no behavior changes. Written for commit 00ff1cce227d1006bdf6fb893d0079ecfa16c9f0. Summary will update on new commits. Review in cubic Co-authored-by: Chromie Bot Co-authored-by: Claude Opus 4.6 --- packages/docs/v3/basics/act.mdx | 5 +---- packages/docs/v3/basics/agent.mdx | 25 +++++-------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/packages/docs/v3/basics/act.mdx b/packages/docs/v3/basics/act.mdx index b6378e5752..68531d9c86 100644 --- a/packages/docs/v3/basics/act.mdx +++ b/packages/docs/v3/basics/act.mdx @@ -112,10 +112,7 @@ You can pass additional options to configure the model, timeout, variables, and ```typescript // Custom model configuration await stagehand.act("choose 'Peach' from the favorite color dropdown", { - model: { - modelName: "google/gemini-2.5-flash", - apiKey: process.env.GEMINI_API_KEY - }, + model: "google/gemini-2.5-flash", timeout: 10000 }); ``` diff --git a/packages/docs/v3/basics/agent.mdx b/packages/docs/v3/basics/agent.mdx index 4be5039c82..740c8f4eaa 100644 --- a/packages/docs/v3/basics/agent.mdx +++ b/packages/docs/v3/basics/agent.mdx @@ -67,10 +67,7 @@ You can use specialized computer use models from Google, OpenAI, Anthropic, or M ```typescript Google const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "google/gemini-2.5-computer-use-preview-10-2025", - apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY - }, + model: "google/gemini-2.5-computer-use-preview-10-2025", systemPrompt: "You are a helpful assistant...", }); @@ -84,10 +81,7 @@ await agent.execute({ ```typescript OpenAI const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "openai/computer-use-preview", - apiKey: process.env.OPENAI_API_KEY - }, + model: "openai/computer-use-preview", systemPrompt: "You are a helpful assistant...", }); @@ -100,10 +94,7 @@ await agent.execute({ ```typescript Anthropic const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "anthropic/claude-sonnet-4-6", - apiKey: process.env.ANTHROPIC_API_KEY - }, + model: "anthropic/claude-sonnet-4-6", systemPrompt: "You are a helpful assistant...", }); @@ -618,10 +609,7 @@ Agents can be enhanced with external tools and services through MCP (Model Conte ```typescript Pass URL const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "openai/computer-use-preview", - apiKey: process.env.OPENAI_API_KEY - }, + model: "openai/computer-use-preview", integrations: [ `https://mcp.exa.ai/mcp?exaApiKey=${process.env.EXA_API_KEY}`, ], @@ -640,10 +628,7 @@ const supabaseClient = await connectToMCPServer( const agent = stagehand.agent({ mode: "cua", - model: { - modelName: "openai/computer-use-preview", - apiKey: process.env.OPENAI_API_KEY - }, + model: "openai/computer-use-preview", integrations: [supabaseClient], systemPrompt: `You can interact with Supabase databases. Use these tools to store and retrieve data.` }); From 7dc7863f2f5e89bb87b7b93ea9a5b819d4ada62b Mon Sep 17 00:00:00 2001 From: Miguel <36487034+miguelg719@users.noreply.github.com> Date: Mon, 6 Apr 2026 11:05:52 -0700 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Miguel <36487034+miguelg719@users.noreply.github.com> --- packages/docs/v3/basics/agent.mdx | 2 +- packages/docs/v3/best-practices/caching.mdx | 2 +- packages/docs/v3/best-practices/deterministic-agent.mdx | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/docs/v3/basics/agent.mdx b/packages/docs/v3/basics/agent.mdx index 740c8f4eaa..aa395f40ba 100644 --- a/packages/docs/v3/basics/agent.mdx +++ b/packages/docs/v3/basics/agent.mdx @@ -67,7 +67,7 @@ You can use specialized computer use models from Google, OpenAI, Anthropic, or M ```typescript Google const agent = stagehand.agent({ mode: "cua", - model: "google/gemini-2.5-computer-use-preview-10-2025", + model: "google/gemini-3-flash-preview", systemPrompt: "You are a helpful assistant...", }); diff --git a/packages/docs/v3/best-practices/caching.mdx b/packages/docs/v3/best-practices/caching.mdx index 7c993ca57f..946ebc4284 100644 --- a/packages/docs/v3/best-practices/caching.mdx +++ b/packages/docs/v3/best-practices/caching.mdx @@ -132,7 +132,7 @@ await page.goto("https://browserbase.github.io/stagehand-eval-sites/sites/drag-d const agent = stagehand.agent({ mode: "cua", - model: "google/gemini-2.5-computer-use-preview-10-2025", + model: "google/gemini-3-flash-preview", systemPrompt: "You are a helpful assistant that can use a web browser.", }); diff --git a/packages/docs/v3/best-practices/deterministic-agent.mdx b/packages/docs/v3/best-practices/deterministic-agent.mdx index 245ad2924f..fc71c73335 100644 --- a/packages/docs/v3/best-practices/deterministic-agent.mdx +++ b/packages/docs/v3/best-practices/deterministic-agent.mdx @@ -62,7 +62,7 @@ await page.goto("https://example.com"); const agent = stagehand.agent({ mode: "cua", - model: "google/gemini-2.5-computer-use-preview-10-2025", + model: "google/gemini-3-flash-preview", systemPrompt: "You are a helpful assistant that can use a web browser.", }); @@ -124,7 +124,7 @@ await page.goto("https://github.com"); const agent = stagehand.agent({ mode: "cua", - model: "google/gemini-2.5-computer-use-preview-10-2025", + model: "google/gemini-3-flash-preview", systemPrompt: "You are a helpful assistant that can use a web browser.", }); @@ -168,7 +168,7 @@ await page.goto("https://github.com"); const agent = stagehand.agent({ mode: "cua", - model: "google/gemini-2.5-computer-use-preview-10-2025", + model: "google/gemini-3-flash-preview", systemPrompt: "You are a helpful assistant that can use a web browser.", }); @@ -213,7 +213,7 @@ await page.goto("https://example.com"); const agent = stagehand.agent({ mode: "cua", - model: "google/gemini-2.5-computer-use-preview-10-2025", + model: "google/gemini-3-flash-preview", systemPrompt: "You are a helpful assistant that can use a web browser.", });