DEV Community

TOPHET
TOPHET

Posted on • Originally published at github.com

Agentic Browser: ~98% fewer tokens than HTML for LLM web agents (Python + MCP)

Agentic Browser is an agent-first Python browser built on Playwright/Chromium so LLMs can drive the web with compact observations, stable element refs, and outcome-verified actions ? not raw HTML dumps.

Why it exists

Traditional scrapers hand models 100k+ tokens of markup. Agents need:

  1. Small structured observations (roles, labels, refs)
  2. Actions that mean success (URL/DOM outcomes)
  3. A plug-in for any host (MCP + OpenAI/Anthropic tool schemas)

Measured token efficiency

Scenario Raw HTML Compact observation Reduction
Quotes scrape ~2.8k?6.2k ~0.45k?1.3k ~78?84%
Rockstar GTA VI landing ~225,000 ~1,300 ~99.4%
GitHub vercel/next.js ~110,000 ~1,900 ~98.3%

Features

  • Stable refs + scoped grounding
  • Outcome verification (e.g. Issues click only OK if URL is /issues)
  • Page gates for challenges (detect & report ? not a bypass tool)
  • MCP server for Cursor / Claude Desktop
  • tools_as_openai() / tools_as_anthropic()
  • 118 automated tests; milestones M1?M10

Install

pip install agent-browser
playwright install chromium
agent-browser --help
# MCP
python -m agent_browser.mcp
Enter fullscreen mode Exit fullscreen mode

Links

MIT ? Python 3.11+

Top comments (1)

Collapse
 
mads_hansen_27b33ebfee4c9 profile image
Mads Hansen

Compact observations plus outcome-verified actions are the right pair. Token reduction alone can hide an information-loss problem, so I would love to see the benchmark extended from observation size to task completion: total tokens per successful task, retries caused by stale refs, and missed targets on virtualized lists, iframes, Shadow DOM, canvas-heavy pages, and delayed hydration. A compact tree that saves 98% but needs three recovery turns may be more expensive than it looks. The explicit page-gate behavior is also a strong design choice: reporting uncertainty is much safer than pretending an action succeeded.