Skip to content

Code Lab

agent-browser Explained: Browser Automation for AI Agents

By Miles Park·
agent-browser GitHub project preview from the vercel-labs/agent-browser repository

CODE LAB · PROJECT SPOTLIGHT

agent-browser Rust · Apache 2.0

Vercel Labs browser automation CLI for AI agents, with interactive snapshots and browser actions.

Preview: vercel-labs/agent-browser on GitHub

agent-browser is an open-source browser automation tool from Vercel Labs designed for AI agents. It gives an agent a command-line way to open pages, inspect their structure and interact with elements, providing a bridge between a language model’s decisions and a browser session.

A contact sheet example from agent-browser documentation
Contact sheet example from the project documentation. Credit: Vercel Labs and contributors.

How the workflow works

An agent can open a page, ask for an interactive snapshot, and use the returned element references to take actions such as clicking. A snapshot gives a compact view of page elements; references like @e1 connect a later command to an element in that view. Pages change, so take a fresh snapshot after navigation or significant updates rather than assuming an old reference still points to the same target.

vercel-labs / agent-browserRust · source excerpt
TS  cli/src/native/snapshot.rs
fn normalize_snapshot_name(name: &str) -> String {    name.chars()        .filter_map(|ch| match ch {            '\u{00A0}' => Some(' '),            ch if ZERO_WIDTH_CHARS.contains(&ch) => None,            ch => Some(ch),        })        .collect()}
Lines 170–178 · commit 4b0e9f0View original on GitHub ↗

Source: Vercel Labs and contributors, Apache License 2.0. Excerpt linked to the reviewed revision.

Where it fits

Browser automation can help with testing and supervised research, but an agent should still verify the page before acting. Login states, changing interfaces and destructive actions require appropriate human controls. For a complementary coding workflow, see our T3 Code introduction.

Sources: Repository · Releases · README

Join the discussion

Your email address will not be published. Required fields are marked *