---
title: "How We Optimized Browser Use for Deep Agents"
description: "Tool design dominated cost and speed for browser agents: across seven toolsets on 100 WebVoyager tasks, pass rates ranged 78–90%, but Stagehand passed 90% for $1.98 total while Playwright MCP passed 78% for $26.71 at three times the latency."
url: "https://swe.quest/articles/how-we-optimized-browser-use-for-deep-agents-2f840018f7b43754"
canonical: "https://www.langchain.com/blog/how-we-optimized-browser-use-for-deep-agents"
source: "LangChain"
published: "2026-11-06"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["ai-agents","evals","performance","llms"]
---

# How We Optimized Browser Use for Deep Agents

A post on [LangChain](https://swe.quest/sources/langchain.md), published 2026-11-06, 9 min read, Case study. Original: [https://www.langchain.com/blog/how-we-optimized-browser-use-for-deep-agents](https://www.langchain.com/blog/how-we-optimized-browser-use-for-deep-agents)

## Summary

Tool design dominated cost and speed for browser agents: across seven toolsets on 100 WebVoyager tasks, pass rates ranged 78–90%, but Stagehand passed 90% for $1.98 total while Playwright MCP passed 78% for $26.71 at three times the latency. The gains came from code mode (one \`run\` call batches many actions and keeps intermediate page data out of context, averaging 10 steps versus 26), compact accessibility-tree snapshots with element IDs instead of raw HTML or screenshots, and running inside the browser to avoid per-action CDP round trips. Accepting Playwright-style code beat Stagehand's native API by 5.3 points, and truncating snapshots after the fact didn't help because agents just re-fetched. Replacing fixed sleeps with a 500 ms network-quiet settle wait cut median HardBench time from 182 s to 124 s with no accuracy loss, all validated through trace-driven iteration and evals.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- LLM tool calling ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- browser automation basics
- Playwright

## Keywords

Stagehand, Browserbase, Playwright MCP, LangSmith, Deep Agents, Chrome DevTools Protocol, WebVoyager, HardBench

## Related posts

- [Browser Use in Managed Deep Agents](https://swe.quest/articles/browser-use-in-managed-deep-agents-21e226e57e61da12.md): LangChain · 2026-11-06 · Medium · 7 min read · AI agents, Testing, Browsers
  Managed Deep Agents in LangSmith now runs a remote browser in its own sandbox and gives agents Stagehand-based tools: browser\_snapshot (accessibility tree with element IDs), browser\_run (batched actions or Playwright-style JavaScript in one call to keep page content out of context), browser\_screenshot, and browser\_handoff for letting a human sign in without exposing credentials.
- [Agentic Testing: Where Agents Fit in the E2E Testing Stack](https://swe.quest/articles/agentic-testing-where-agents-fit-in-the-e2e-testing-stack-fa760680a95bc5c9.md): Slack Engineering · 2026-06-11 · Medium · 11 min read · Testing, AI agents, LLMs, Cost optimization
  Across 200+ agent-driven E2E runs against Slack test workspaces, agents using Playwright MCP were the most reliable (0% failures on a simple thread-reply flow, ~12% on a longer search flow).
- [Harness design for long-running apps](https://swe.quest/articles/harness-design-for-long-running-apps-8e65b1112006c61b.md): Anthropic Engineering · 2026-03-24 · Medium · 23 min read · AI agents, AI for coding, Evaluation, LLMs, Frontend
  A GAN-inspired multi-agent harness separates generation from evaluation so Claude can produce distinctive frontend designs and build full-stack apps autonomously over multi-hour sessions.
- [The Most Common Questions About Agent Evals, Answered](https://swe.quest/articles/the-most-common-questions-about-agent-evals-answered-40ebbb294f8cf253.md): LangChain · 2026-10-15 · Medium · 15 min read · Evaluation, AI agents, Observability, LLMs
  Agent evals score agent runs to handle nondeterminism, multiple valid answers and variable execution paths: start by reading traces, pick one behavior, build a 10-20 example dataset from real traces, run a baseline experiment, and fold new failures back in.
- [2,000 robots walk into a shop...](https://swe.quest/articles/2-000-robots-walk-into-a-shop-197e6155a91a1c15.md): Shopify Engineering · 2026-02-27 · Hard · 8 min read · Inference & serving, AI agents, LLMs, Performance engineering, Hardware
  SimGym runs simulated A/B tests on Shopify storefronts by sending up to 2,000 concurrent LLM-driven shopper agents through Browserbase cloud browsers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
