Skip to content
The AI Database
Screenshot of agent-browser

agent-browser

agent-browser.dev

agent-browser is a command-line interface for headless browser automation, designed for AI agents. It uses a Rust CLI and a Node.js daemon that manages a Playwright browser, and outputs compact text snapshots with element references.

Visit website (opens in a new tab)

At a glance

Headless Browser Automation for AI

Overview

The Headless Browser Automation CLI, referred to as agent-browser, is a specialized tool designed for AI agents. This command-line interface (CLI) focuses on efficient interactions with web browsers using a unique architecture that minimizes the context usage required by AI systems. By employing a fast Rust-based implementation with support for Node.js as a fallback, agent-browser significantly enhances the browsing experience for AI entities.

Installation

To begin using agent-browser, users can install it via command-line interfaces:

  • For all platforms, including Windows, Linux, and macOS, the fastest native Rust CLI can be installed using npm:

    npm install -g agent-browser
    
  • Alternatively, for macOS users, it can be installed using Homebrew:

    brew install agent-browser
    
  • Those who prefer not to install can try the utility directly with npx:

    npx agent-browser open example.com
    

Features

agent-browser comes equipped with a variety of features tailored for optimizing browser automation for AI:

Agent-first

The tool prioritizes an agent-first approach, providing compact text output that consumes fewer tokens than traditional JSON formats, thereby enhancing context efficiency for AI.

Ref-based System

The snapshot command generates an accessibility tree with unique references (refs) for elements. This allows for deterministic and efficient interactions with specific elements on the page.

Speed and Performance

With a Rust-based CLI, command parsing is executed quickly, ensuring that users experience minimal latency when issuing commands.

Comprehensive Command Set

The CLI supports over 50 commands covering a range of functionalities, such as navigation, form submissions, screenshot capturing, network interactions, and storage manipulation.

Session Management

Users can run multiple isolated browser instances, each with separate authentication credentials, facilitating parallel operations without overlap.

Cross-Platform Compatibility

The tool supports multiple operating systems including macOS, Linux, and Windows, with native binaries ensuring optimal performance on each platform.

Compatibility with AI Systems

The agent-browser is designed to integrate seamlessly with various AI systems, including:

  • Claude Code
  • Cursor
  • GitHub Copilot
  • OpenAI Codex
  • Google Gemini
  • opencode

It works with any agent capable of executing shell commands, making it a versatile choice for developers utilizing AI in their projects.

Example Commands

To illustrate its functionality, here are some example commands:

  1. Navigate to a website and capture a snapshot:

    agent-browser open example.com
    agent-browser snapshot -i
    

    Sample Output:

    - heading "Example Domain" [ref=e1]
    - link "More information..." [ref=e2]
    
  2. Interact with the identified elements using their references:

    agent-browser click @e2
    agent-browser screenshot page.png
    agent-browser close
    

Advantages of Using Refs

The unique ref-based system enhances the experience in several key ways:

  • Context Efficiency: The text output generated is between 200-400 tokens, compared to 3000-5000 tokens for full DOM representations.
  • Deterministic Specifically: Each ref directs to an exact element from the snapshot, reducing ambiguity during interactions.
  • Speed Optimization: The use of refs allows for faster operations without the need to re-query the DOM.
  • AI-Friendliness: The compact text output is easy to parse for large language models (LLMs), making interactions smooth and intuitive.

Architecture

The agent-browser employs an innovative client-daemon architecture to maximize performance:

  1. Rust CLI: This component is responsible for command parsing and communication with the daemon.
  2. Node.js Daemon: It manages the Playwright browser instance, ensuring efficient operation and response.

This daemon starts automatically and persists, making it available between commands without needing to be re-invoked after every interaction.

Platforms Supported

agent-browser provides native binaries for the following platforms:

  • macOS: Supports ARM64 and x64 architectures.
  • Linux: Compatible with ARM64 and x64 systems.
  • Windows: Suitable for x64 architecture.

Conclusion

The agent-browser is a powerful CLI tool for browser automation within AI contexts. Its compact and efficient design allows developers and AI practitioners to interact with web applications more effectively, streamlining tasks and reducing overhead associated with traditional methods. This tool is particularly beneficial for developers integrating AI systems with web technologies, ensuring they can harness the full power of AI while maintaining optimal performance and efficiency. Whether for personal projects or professional applications, agent-browser offers a unique and valuable solution for headless browser automation.

Ready to try it? Visit agent-browser.dev (opens in a new tab)

  • Screenshot of ScreenEnv

    ScreenEnv

    huggingface.co
    Category
    Development Tools
    What it does
    ScreenEnv is a Python library for creating isolated Ubuntu desktop environments inside Docker containers. It lets developers and researchers build and test GUI agents that control the mouse, keyboard, windows, files and terminal, through a Direct Sandbox API or an MCP server.
  • Screenshot of Crawl4AI

    Crawl4AI

    github.com
    Category
    Development Tools
    What it does
    Crawl4AI is an open-source web crawler and scraper that produces LLM-friendly Markdown and structured data from web pages. It supports browser control, CSS-based extraction and LLM-driven structured extraction, and can be installed via pip or Docker.
  • Screenshot of Agent TARS

    Agent TARS

    agent-tars.com
    Category
    AI Agents
    What it does
    Agent TARS is an open-source multimodal AI agent that lets users control and automate web browsing through natural language commands. It can interact with page elements via the browser DOM and is set up locally with an npx command.
  • Screenshot of MCP-B

    MCP-B

    mcp-b.ai
    Category
    Development Tools
    What it does
    MCP-B (Model Context Protocol for the Browser) is a framework that embeds MCP servers in web pages so AI assistants can call a site's functionality directly. It uses existing browser sessions for authentication and is distributed as an npm package and a Chrome extension.