Skip to main content
LangChain Deep Agents is a framework for building planner-style agents that delegate work to subagents and pause for human approval at sensitive steps. Pair it with Browserbase to give the agent cheap web context, rendered extraction, and full interactive browser sessions.

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.
The first two run on the main agent for cheap context. The last two live on a 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

1

Get your API key

Go to the Dashboard’s Settings tab:
Copy your API key and set the BROWSERBASE_API_KEY environment variable.
2

Install dependencies

3

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.
4

Define the Browserbase tools

Wrap the Browserbase SDK and Stagehand in @tool-decorated functions. The main agent gets browserbase_search and browserbase_fetch; the subagent gets the rendered and interactive variants.
See the full browser_tools.py for the Stagehand-backed browserbase_rendered_extract and browserbase_interactive_task tools.
5

Build the Deep Agent

Give the planner the cheap tools, register the browser subagent, and gate browserbase_interactive_task behind interrupt_on.
6

Run with human approval

When the agent calls browserbase_interactive_task, the run pauses. Approve, edit the arguments, or reject before the browser session executes.

When to use which tool

Front-load the cheap tools. Escalate to a browser session only when the page or task demands it.

Why approve at the tool boundary

Deep Agents interrupt_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.