Architecture
This integration exposes Browserbase to the Deep Agent as four Python tools:browserbase_search— fast discovery with the Browserbase Search API.browserbase_fetch— quick retrieval of static pages with the Browserbase Fetch API.browserbase_rendered_extract— Stagehand-backed extraction for JavaScript-heavy pages.browserbase_interactive_task— a Stagehand agent that handles clicks, typing, logins, and form submissions.
browser-specialist subagent that isolates browser-heavy work from the planner. Stateful actions go through Deep Agents interrupt_on, so you approve each interactive task at the tool boundary.
The full source is on GitHub.
Quickstart
Get your API key
Go to the Dashboard’s Settings tab:
Copy your API key and set the

BROWSERBASE_API_KEY environment variable.Configure environment
The Deep Agent model client and the Browserbase tools both read from environment variables.Point
DEEPAGENT_BASE_URL at any OpenAI-compatible endpoint. With the Browserbase Model Gateway, you can run the entire sample with a single Browserbase API key.Define the Browserbase tools
Wrap the Browserbase SDK and Stagehand in See the full
@tool-decorated functions. The main agent gets browserbase_search and browserbase_fetch; the subagent gets the rendered and interactive variants.browser_tools.py for the Stagehand-backed browserbase_rendered_extract and browserbase_interactive_task tools.Build the Deep Agent
Give the planner the cheap tools, register the browser subagent, and gate
browserbase_interactive_task behind interrupt_on.When to use which tool
| Tool | Use when | Cost |
|---|---|---|
browserbase_search | You need to discover URLs from a query. | Cheap, no browser session. |
browserbase_fetch | You have a URL and the page renders without JavaScript. | Cheap, no browser session. |
browserbase_rendered_extract | The page needs JavaScript to render content you want to read. | Full browser session. |
browserbase_interactive_task | The task requires clicking, typing, login, or form submission. | Full browser session, gated behind interrupt_on. |
Why approve at the tool boundary
Deep Agentsinterrupt_on pauses the run when the agent picks a guarded tool. Putting human approval on browserbase_interactive_task means the human sees the exact start_url and task arguments before any clicks, typing, or form submission run in the browser. Browserbase records the resulting session, so you get a replay of every approved action.
Further reading
LangChain Deep Agents
The Deep Agents framework — planners, subagents, and human-in-the-loop interrupts.
Search and Fetch APIs
Cheap, token-efficient web context for agents. Use these before opening a browser.
Stagehand
The SDK for browser agents. Powers rendered extraction and interactive tasks.
Model Gateway
Frontier models behind a single Browserbase API key with unified billing.