# π§ web-agent-bench
**A fair, reproducible benchmark for the different ways to give an LLM a web browser.**
Measured on **token usage**, **speed**, and **reliability**, with one identical Claude brain driving every approach.
[](./LICENSE)
[](https://nodejs.org)
[](https://www.python.org)
---
## The contenders
Five locally-runnable drivers across four tool methodologies. agent-browser is run in **two harnesses** (a minimal API loop and the Claude Code Agent SDK) to isolate what the harness itself costs:
| Tool | Methodology | Agent loop | What it feeds the model |
|---|---|---|---|
| π **Playwright MCP** | accessibility tree | Claude Agent SDK (MCP) | a11y snapshot + refs |
| β‘ **agent-browser** (thin) | accessibility refs | minimal API loop (Bash + CLI) | `snapshot β @e1` refs |
| β‘ **agent-browser** (Claude Code) | accessibility refs | Claude Agent SDK (Bash + CLI) | `snapshot β @e1` refs |
| π **browser-use** | hybrid DOM + vision | its own Python loop | DOM elements **+ a screenshot** |
| π― **Stagehand** | NL primitives | its own loop (`act`/`observe`/`extract`) | structured, cache-able actions |
They live at different layers, which is exactly what makes a naΓ―ve comparison misleading. This repo fixes the model and varies the browser tooling, and for agent-browser the harness around the same tool.
## Fairness model
The diagram above is the whole idea: one Claude model, several sets of "hands," one local site.
- **Playwright MCP** runs on the [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview) (the MCP server is its tool layer).
- **agent-browser** (thin) runs on a **minimal API loop** (`src/drivers/thinLoop.ts`) that drives the CLI via a single Bash tool. It carries only the task prompt, a short CLI guide, and the tool schema (no Claude Code preset), so its token counts reflect the browser work rather than a large built-in system prompt re-read every turn.
- **agent-browser-cc** runs the **same** agent-browser CLI on the Claude Code Agent SDK, with the same guide. It's the A/B partner to the thin driver: identical tool layer, only the harness differs, so it isolates what the heavy harness costs (and whether it buys anything).
- **browser-use** and **Stagehand** bring *their own loop*.
- All drivers share the **same model and account**: the API-loop and own-loop drivers (agent-browser thin, browser-use, Stagehand) point their Anthropic client at a tiny local proxy (`src/proxy/oauthProxy.ts`); the Agent SDK drivers (Playwright MCP, agent-browser-cc) use the logged-in `claude` CLI.
- Every cost is **re-priced uniformly** from raw token counts (each tool reports cost differently, or not at all). See `src/core/pricing.ts`.
- Every driver gets the **same hands within the browser**: UI actions only (snapshot/click/type/scroll/screenshot). Shell, in-page JS `eval`, and direct network/file access are blocked, so no driver can fetch an answer instead of doing the task.
## Quickstart
**Prerequisites:** Node β₯ 22, Python β₯ 3.13 + [uv](https://github.com/astral-sh/uv), [Claude Code](https://claude.com/claude-code) logged in (no `ANTHROPIC_API_KEY` needed), macOS or Linux.
```bash
npm run setup # Node + Python deps, browsers, agent-browser CLI
claude setup-token # one-time, opens browser login, prints sk-ant-oat01-...
cp .env.example .env # paste that token into .env
npm run list # see every suite, scenario, driver, model
npm run bench # run the default suite
```