Browser Harness

Browser Harness (browser-use/browser-harness) is an open-source, minimal Python automation framework developed by Browser Use. By connecting large language models and coding agents directly to Chrome via a single Chrome DevTools Protocol (CDP) WebSocket, it enables autonomous web interaction. Its standout self-healing architecture allows the AI agent to write missing helper functions mid-task on the fly, dynamically expanding its capabilities with every executed workflow.

Traditional browser automation tools for AI agents often break when encountering non-standard DOM components, file uploads, complex login walls, or subtle interface changes. Browser Harness circumvents brittle, predefined wrapper APIs by combining a compact core engine with an agent-extensible helper workspace. Instead of failing when a helper method does not exist, the coding agent inspects the requirement, writes the custom helper function into its workspace, and resumes execution seamlessly.

Core Architecture & Capabilities at a Glance

Feature / Metric Technical Specification Core Advantage
Core Footprint Minimal Python codebase (~600 LOC) Lightweight, transparent, and easy to audit or customize.
Connection Protocol Direct Chrome DevTools Protocol (CDP) Real-time control of local Chrome or remote Chromium instances.
Self-Healing Loop agent_helpers.py Workspace Generation Agent writes its own helper functions when missing, preventing task halts.
Element Targeting Accessibility Tree (AX Tree) + Box Models Fast, coordinate-accurate clicks that bypass shadow DOM and iframe barriers.
Environment Support Local Logged-in Chrome & Browser Use Cloud Leverages personal user sessions locally or scales via headless cloud runners.
Agent Tool Support Claude Code, Cursor, Codex, Gemini CLI Native compatibility with modern CLI coding assistants via .skill registers.

Key Highlights and Technical Advantages

  • Self-Improving Workspace Engine: The core library (src/browser_harness/) remains protected while the agent writes reusable helper scripts inside agent-workspace/. As the agent solves difficult tasks (such as drag-and-drop elements or custom canvas inputs), it stores new utilities that benefit all future runs.

  • Native Accessibility-Tree First Navigation: Rather than burning compute tokens by processing raw screenshot images on every turn, Browser Harness parses Chrome’s Accessibility Tree (getFullAXTree). This drastically reduces context token consumption and latency while pinpointing precise interactive elements.

  • Direct Coordinate Compositor Clicks: Calculates element viewport center points directly from DOM bounding box coordinates (DOM.getBoxModel). This allows synthetic mouse clicks to pierce through complex Shadow DOMs, Canvas elements, and cross-origin iframes without breaking.

  • Seamless Session Authentication: Attaches directly to your running Chrome profile via remote debugging (chrome://inspect/#remote-debugging), allowing agents to perform tasks using existing login sessions, enterprise SSO, and stored cookies without re-authenticating.

  • Cloud Scaling Ready: Easily scales from local desktop debugging to Browser Use Cloud, unlocking parallel instances with automatic proxy rotation, CAPTCHA solving, and stealth fingerprint protection.