# Create an agent that can browse the web with Managed Deep Agents and Browserbase's Stagehand <!-- ref: @content/youtube/langchain/agent-that-can-browse-the-web-with-managed-deep-agents-and-browserbases-stagehand tags: [web browsing agents, Stagehand, Browserbase, Managed Deep Agents, browser automation, LangSmith, Playwright] version: 2 updated_at: 2026-11-24T06:14:18.648Z --> **[Watch on YouTube](https://www.youtube.com/watch?v=O0hkpChFBkM)** # Create an agent that can browse the web with Managed Deep Agents and Browserbase's Stagehand *Synthesized from LangChain, 2026-08-10; speakers are not named in the source.* A single presenter, not named in the transcript, builds a web-browsing agent from the LangChain managed-agent example that uses Stagehand V4 tools and Browserbase browser infrastructure. ## Core Thesis The presenter argues that a web-browsing agent can be assembled from three parts: Managed Deep Agents for the agent runtime and deployment, Stagehand V4 for the browser tools, and Browserbase for managed, scalable browser sessions. Stagehand can drive a local Playwright browser, but Browserbase is the choice for production. ## Key Insights - Managed Deep Agents runs the open-source, model-independent Deep Agent toolkit inside a LangSmith deployment. It connects to Context Hub for skills, instructions and memories, to Slack, to Harbor for evaluation, and to sandboxes (for untrusted code) and MCP connectors. - Stagehand V4 is an open-source browser-interaction library. It can connect to local Playwright browsers or, for production, to Browserbase. - The example agent, named "Stagehand browser agent", is given three tools: `snapshot`, `run` and `screenshot`. `snapshot` reads the active page and adds element IDs in parentheses. `run` accepts snapshot actions or JavaScript with the Playwright page API. `screenshot` checks the rendered page visually. - Agent instructions: use snapshot actions for simple interactions and `run` code for multi-step workflows. Snapshot IDs are only valid for the last snapshot of the active page. Take a new screenshot after navigation or when an ID is outdated. Never try to launch another browser. - Setup: API keys for LangSmith, the model provider (OpenAI in the demo) and Browserbase go in the environment file. `mda dev` runs the local Studio, and `mda deploy` builds the deployment, which also creates a Context Hub record for the instructions. The instructions can be edited there without redeploying. LangSmith deployments need a paid plan. - Demo: "go to espn.com and find out the main news" succeeded. A second task, opening three Hacker News articles, was replayed in the Browserbase session view, which shows the live browser and the navigation history. ## Actionable Takeaways 1. Use `snapshot` actions for single steps and `run` code for multi-step flows, and refresh snapshots after navigation. 2. Keep the agent on one persistent browser session and forbid it from launching a second browser. 3. Use Browserbase for deployed agents and local Playwright only for development. 4. Review each session replay in Browserbase to see what the agent actually clicked and loaded. ## Notable Quotes > "Snapshot IDs are only valid for the last snapshot of the active page." — LangChain presenter (not named in the source) > "Never try to launch another browser." — LangChain presenter (not named in the source) --- *Related: `@content/youtube/yifan-bth/how-to-build-robust-applications-with-cursor-ai-playwright` · `@content/youtube/yifan-bth/5x-your-cursor-ai-coding-quality-with-these-pro-tips` · `@content/youtube/yifan-bth/let-the-agent-write-the-tests-and-the-fixes` · `@content/youtube/yifan-bth/my-day-to-day-ai-dev-workflow-git-cursor-windsurf-cline-playwright-supabase-replit` · `@content/youtube/langchain/langsmith-preview-builds-test-agent-changes-before-production`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*