Latest commit
History
Folders and files
Repository files navigation
🌐 Agent First Browse
Fast, token-efficient autonomous browser control for AI agents. Accessibility-tree-first perception · LangGraph verification · Native zero-API MCP & CLI
Demo · Capabilities · Architecture · Benchmarks · Quick Start · Docs
Live Demo
Why Agent First Browse?
Most browser agents burn thousands of tokens per step on raw DOM dumps, sleep on fixed timers, or click stale coordinates behind overlays. Agent First Browse treats the browser as a structured, verifiable environment for AI agents:
Architecture
Drive real Chromium either autonomously through the LangGraph verification brain or directly from any AI coding agent (Antigravity, Claude Code, Cursor, VS Code, Gemini CLI) with zero external LLM API keys:
flowchart LR subgraph Entry["Entry Surfaces"] E1["Autonomous Brain\nLangGraph StateGraph"] E2["External AI Agent\nNative MCP stdio or CLI"] end subgraph Perception["V2 Perception Pipeline"] P1["Adaptive Settle\nMutationObserver"] P2["DOM + Tier-2 A11y\nSecret Redaction"] P3["Occlusion Filter\nPaint-Order Hit-Test"] P4["Delta Compressor\nCompact Ref Roster"] P1 --> P2 --> P3 --> P4 end subgraph Execution["Verification and Action Engine"] X1["Overwatch Gate\nL1-L5 Grounding and Reality"] X2["Stale-Ref Rebind\n4-Tier CDP + Stealth Chromium"] X1 --> X2 end subgraph Core["Shared Core Primitives"] C1["URL Policy and Redaction\nTyped Errors and Retries\nContextVar DI and Telemetry"] end E1 --> P1 E2 --> P1 P4 --> X1 X2 -. "Next state" .-> P1 Core -. "Guards and observes" .-> Execution
Verified Benchmarks
Measured on live headed Chromium ( headless=False , zero external LLM API keys, AI agent acting directly as the decision-making brain across live websites and diagnostic stress scenarios):
Quick Start
Requires Python 3.11+ on Linux, WSL, or macOS.
# Install from PyPI pip install agent-first-browse && python -m playwright install chromium # Or install from source git clone https://github.com/SandeepAi369/Agent-first-browse.git && cd Agent-first-browse python3 -m venv .venv && source .venv/bin/activate pip install -e . && python -m playwright install chromium
Run Your First Task
# Autonomous LangGraph run (configure keys once via: cp .env.example .env) agent-first-browse run --mode v2 " Open https://news.ycombinator.com and find the top 3 stories "
Want zero external API keys ? Connect Antigravity, Claude Code, Cursor, VS Code, or Gemini CLI directly via native MCP or the stateful CLI daemon:
Copy .mcp.json.example into your MCP client config:
{ "mcpServers" : { "agent-first-browse-eval" : { "command" : " .venv/bin/python " , "args" : [ " -m " , " eval_connector.mcp_server " ], "env" : { "PYTHONPATH" : " src " } } } }
# Start paired Legacy + V2 sessions on any live URL (add --headed to watch on screen) agent-eval start-pair live --url https://news.ycombinator.com --headed # Compare speed, tokens, occlusion pruning, and element visibility side-by-side agent-eval compare live_legacy live_v2 # Step-by-step perception and actions agent-eval perceive live_v2 agent-eval act live_v2 click e1 --auto-perceive agent-eval screenshot live_v2 # Export cumulative report and shut down cleanly agent-eval report --json-out eval_report.json agent-eval stop --daemon
(Without pip install -e . , replace agent-eval with .venv/bin/python scripts/agent_eval.py .)
# Optional on headless Linux/WSL for stealth headed display inside Xvfb sudo apt-get install -y xvfb # Run with baseline legacy mode for side-by-side comparison ./agent.sh --mode legacy " Open https://news.ycombinator.com and find the top 3 stories " # Invoke Python directly (add --headless to run without a display) .venv/bin/python src/run_v16.py run --mode v2 " Log in to https://the-internet.herokuapp.com/login and verify the secure area "
# Full offline unit + local-Chromium test suite (528 tests) .venv/bin/pytest -q # Architectural guardrails (frozen modules, universal-only perception, exports, secrets, test hygiene) .venv/bin/python scripts/check_guardrails.py --strict-test-hygiene # Scoped lint & progressive typecheck (mirrors GitHub Actions CI) .venv/bin/ruff check src/core src/v2_engine src/eval_connector scripts/check_guardrails.py .venv/bin/mypy src/core src/v2_engine src/eval_connector scripts/check_guardrails.py # Built-in side-by-side Legacy vs V2 local stress benchmark (zero API keys) .venv/bin/python scripts/benchmark_v2_vs_legacy.py --suite local
Documentation
License & Support
Licensed under the Apache License 2.0 — see LICENSE .
If you find Agent First Browse useful, consider starring the repo or supporting ongoing open-source development via GitHub Sponsors .
About
Fast, token-efficient AI browser agent that sees, clicks, types, and completes real web tasks autonomously - with native MCP & CLI control.