Agent-first-browse is an open-source Python browser-automation system for AI agents, built with Playwright and LangGraph. It aims to make web tasks faster and less costly in model context by treating pages as structured, changing environments rather than sending agents large, repetitive DOM dumps. Its central techniques include waiting for pages to settle based on observed DOM mutations instead of fixed delays, removing controls hidden behind dialogs and overlays, and returning incremental snapshots that identify added, changed, or removed elements. When ordinary DOM perception finds too little, the system escalates to browser accessibility trees. It also includes safeguards for verifying actions and rebinding references when page elements move or rerender.
The project’s headed-Chromium benchmarks compare its newer engine with a legacy mode across seven scenarios, including forms, modals, single-page-app rerenders, and custom accessibility widgets. Reported session averages are 96.8 milliseconds and 341 tokens per step, versus 1,164.4 milliseconds and 754 tokens for the baseline; the README characterizes this as 12 times faster and 54.8% fewer tokens. In a modal test, occlusion pruning reduces the perceived controls from 46 to two, while a rerender test recovers from a stale target that defeats the baseline. The package offers autonomous LangGraph runs, a seven-tool native MCP server, and a stateful CLI for direct agent control without external model API keys. It requires Python 3.11 or later and includes 528 tests.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.