### Install and Run agent-browser Demo Source: https://github.com/vercel-labs/agent-browser/blob/main/examples/environments/README.md Install dependencies and start the local development server for the agent-browser environments demo. ```bash cd examples/environments pnpm install pnpm dev ``` -------------------------------- ### Quick Start (No Install) Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Run Agent Browser commands directly using npx without a prior installation. The 'install' command downloads Chrome if it's the first time. ```bash npx agent-browser install # Download Chrome (first time only) npx agent-browser open example.com ``` -------------------------------- ### Install Dependencies and Setup Environment Source: https://github.com/vercel-labs/agent-browser/blob/main/benchmarks/README.md Installs project dependencies using pnpm and copies the environment configuration file. Ensure you have Node.js 18+ and pnpm installed. ```bash cd benchmarks pnpm install cp .env.example .env ``` -------------------------------- ### Install from Source Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Clones the repository, installs dependencies, builds the project, and links it globally. The 'install' command downloads Chrome on the first use. ```bash git clone https://github.com/vercel-labs/agent-browser cd agent-browser pnpm install pnpm build pnpm build:native ./bin/agent-browser install pnpm link --global ``` -------------------------------- ### Install and Open URL with Agent Browser CLI Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/SKILL.md Installs the agent-browser globally and opens a specified URL. Run 'agent-browser install' once after global installation. ```bash # Install once npm i -g agent-browser && agent-browser install # Take a screenshot of a page agent-browser open https://example.com agent-browser screenshot home.png agent-browser close ``` -------------------------------- ### Start Recording with Initial Navigation Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/recording/page.mdx Initiate a browser session and immediately start recording to a WebM file, navigating to a specified URL. ```bash agent-browser open agent-browser record start ./demo.webm https://example.com ``` -------------------------------- ### Install and Get Core Skill Source: https://github.com/vercel-labs/agent-browser/blob/main/skills/agent-browser/SKILL.md Install the agent-browser CLI globally and then fetch the core skill content for workflows and troubleshooting. This is the starting point for using the tool. ```bash npm i -g agent-browser && agent-browser install ``` ```bash agent-browser skills get core ``` ```bash agent-browser skills get core --full ``` -------------------------------- ### Start and Open Session Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/dashboard/page.mdx Start the dashboard server and open a session to a website. ```bash agent-browser dashboard start agent-browser open example.com ``` -------------------------------- ### Start MCP Server with All Tools Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Starts the MCP server including all available tools for full CLI parity and advanced features. ```bash agent-browser mcp --tools all ``` -------------------------------- ### Start Tracing Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/commands/page.mdx Command to start the tracing process. ```bash agent-browser trace start # Start trace ``` -------------------------------- ### Install Agent Browser and Run Commands Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Install the agent-browser globally using npm and then use it to download Chrome, open a website, or take a snapshot. ```bash npm install -g agent-browser # 7 MB install agent-browser install # download Chrome agent-browser open example.com agent-browser snapshot ``` -------------------------------- ### Start Video Recording Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/commands/page.mdx Command to start recording video to a WebM file. ```bash agent-browser record start # Start video recording (WebM) ``` -------------------------------- ### Install and Manage Agent Browser Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Commands for installing, upgrading, and diagnosing the agent-browser installation. Use `--with-deps` on Linux to also install system dependencies. ```bash agent-browser install # Download Chrome from Chrome for Testing (Google's official automation channel) agent-browser install --with-deps # Also install system deps (Linux) agent-browser upgrade # Upgrade agent-browser to the latest version agent-browser doctor # Diagnose the install and auto-clean stale daemon files agent-browser doctor --fix # Also run destructive repairs (reinstall Chrome, purge old state, ...) agent-browser doctor --offline --quick # Skip network probes and the live launch test agent-browser mcp # Start an MCP stdio server ``` -------------------------------- ### Start Profiling Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/commands/page.mdx Command to start Chrome DevTools profiling. ```bash agent-browser profiler start # Start Chrome DevTools profiling ``` -------------------------------- ### Start MCP Server with Default Tools Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Starts the Model Context Protocol server with the default 'core' tool profile for basic browser automation. ```bash agent-browser mcp ``` -------------------------------- ### Pre-navigation Setup (Batch Command) Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Execute a sequence of commands in a single turn to set up the browser environment before the first navigation. ```APIDOC ## Pre-navigation Setup (Batch Command) ### Description Execute a sequence of commands in a single turn to set up the browser environment before the first navigation. This is useful for configuring network routes, cookies, or initial scripts before the initial page load. ### Command - **batch** - Description: Executes an array of commands in sequence. Useful for staging browser state like network interception, cookies, or initial scripts before the first navigation. - Usage: `agent-browser batch [command1] [command2] ...` - Example: ```bash agent-browser batch \ '["open"]' \ '["network","route","*","--abort","--resource-type","script"]' \ '["cookies","set","--curl","cookies.curl","--domain","localhost"]' \ '["navigate","http://localhost:3000/target"]' ``` ### Notes Using `open` without a URL allows for a clean launch. Any interceptions, cookies, or init scripts registered will take effect on the *first* real navigation. This is beneficial for SSR-only debugging, protected-origin authentication, or capturing fresh state without interference from previous pages. ``` -------------------------------- ### CLI Command: profiler start Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/profiler/page.mdx Starts the performance profiling process for the browser session. ```APIDOC ## CLI Command: profiler start ### Description Starts recording a performance profile for the current browser session. ### Parameters #### Query Parameters - **--categories** (string) - Optional - A comma-separated list of Chrome trace categories to capture (e.g., "devtools.timeline,v8.execute"). ### Request Example agent-browser profiler start --categories "devtools.timeline,v8.execute" ``` -------------------------------- ### Install, Start, and Stop Agent Browser Dashboard Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Commands to manage the local observability dashboard. The dashboard provides a live UI for browser sessions. ```bash agent-browser dashboard install agent-browser dashboard start agent-browser open example.com # session appears in dashboard agent-browser dashboard stop ``` -------------------------------- ### Install Appium and XCUITest Driver Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/ios/page.mdx Install Appium globally and then install the XCUITest driver for iOS automation. ```bash npm install -g appium ``` ```bash appium driver install xcuitest ``` -------------------------------- ### Start, Perform Actions, and Stop Profiling Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/profiler/page.mdx This sequence demonstrates the basic workflow for starting the profiler, performing browser actions, and then stopping the profiler to save the trace data to a file. ```bash agent-browser profiler start ``` ```bash agent-browser navigate https://example.com ``` ```bash agent-browser click "#button" ``` ```bash agent-browser profiler stop ./trace.json ``` -------------------------------- ### Start MCP Server with Specific Tools Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Starts the MCP server with a custom selection of tool profiles, such as 'core', 'network', and 'react'. ```bash agent-browser mcp --tools core,network,react ``` -------------------------------- ### Basic Recording Workflow Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/recording/page.mdx Start a browser session, begin recording to a WebM file, perform actions, and then stop the recording. ```bash agent-browser open https://example.com agent-browser record start ./demo.webm agent-browser snapshot -i agent-browser click @e1 agent-browser record stop ``` -------------------------------- ### Global Installation Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Installs Agent Browser globally using npm. Run 'agent-browser install' to download Chrome for Testing on the first use. ```bash npm install -g agent-browser agent-browser install # Download Chrome from Chrome for Testing (first time) ``` -------------------------------- ### Homebrew Installation (macOS) Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Installs Agent Browser on macOS using Homebrew. Run 'agent-browser install' to download Chrome on the first use. ```bash brew install agent-browser agent-browser install # Download Chrome (first time) ``` -------------------------------- ### Basic Video Recording Workflow Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/video-recording.md Launch the browser, start recording to a WebM file, perform actions, and then stop the recording. ```bash # Launch the browser, then start recording agent-browser open https://example.com agent-browser record start ./demo.webm # Perform actions agent-browser snapshot -i agent-browser click @e1 agent-browser fill @e2 "test input" # Stop and save agent-browser record stop ``` -------------------------------- ### Start MCP Server with Specific Tools Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Starts an MCP server with a custom set of tools. Tools can be specified individually or as 'all' for full CLI parity. Profiles can be combined using commas. ```bash agent-browser mcp --tools all agent-browser mcp --tools core,network,react ``` -------------------------------- ### Snapshot Output Format Example Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/snapshot-refs.md This is an example of the output format from the `snapshot` command, showing the hierarchical structure of elements with assigned refs. ```text Page: Example Site - Home URL: https://example.com @e1 [header] @e2 [nav] @e3 [a] "Home" @e4 [a] "Products" @e5 [a] "About" @e6 [button] "Sign In" @e7 [main] @e8 [h1] "Welcome" @e9 [form] @e10 [input type="email"] placeholder="Email" @e11 [input type="password"] placeholder="Password" @e12 [button type="submit"] "Log In" @e13 [footer] @e14 [a] "Privacy Policy" ``` -------------------------------- ### Snapshot Command Output Example Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/snapshots/page.mdx Example of the default text output format for the snapshot command when using the -i option. ```bash agent-browser snapshot -i # Output: # @e1 [heading] "Example Domain" [level=1] # @e2 [button] "Submit" # @e3 [input type="email"] placeholder="Email" # @e4 [link] "Learn more" ``` -------------------------------- ### Install agent-browser CLI Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/page.mdx Install the agent-browser CLI globally using npm or Homebrew. Download Chrome if it's the first time using the tool. ```bash npm install -g agent-browser # all platforms brew install agent-browser # macOS agent-browser install # Download Chrome (first time) ``` -------------------------------- ### AgentCore Configuration Examples Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/providers/agentcore/page.mdx Common usage patterns including persistent profiles, region selection, and SSO profile authentication. ```bash # Basic usage (credentials auto-resolved via AWS CLI) agent-browser -p agentcore open https://example.com # With a browser profile for persistent login state AGENTCORE_PROFILE_ID=my-profile agent-browser -p agentcore open https://x.com/home # With explicit region AGENTCORE_REGION=eu-west-1 agent-browser -p agentcore open https://example.com # With SSO profile AWS_PROFILE=my-sso-profile agent-browser -p agentcore open https://example.com ``` -------------------------------- ### Profiler Commands: Start and Stop Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/profiling.md Commands to initiate and terminate performance profiling. The start command can optionally include custom trace categories. ```bash # Start profiling with default categories agent-browser profiler start # Start with custom trace categories agent-browser profiler start --categories "devtools.timeline,v8.execute,blink.user_timing" # Stop profiling and save to file agent-browser profiler stop ./trace.json ``` -------------------------------- ### Agent Browser Quick Start Commands Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Basic commands to open a URL, take a snapshot, interact with elements by reference, and close the browser. ```bash agent-browser open example.com agent-browser snapshot # Get accessibility tree with refs agent-browser click @e2 # Click by ref from snapshot agent-browser fill @e3 "test@example.com" # Fill by ref agent-browser get text @e1 # Get text by ref agent-browser screenshot page.png agent-browser close ``` -------------------------------- ### Install Agent Browser Skills Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/skills/page.mdx Use this command to install the discovery skill for agent-browser. This skill teaches your agent about agent-browser and directs it to use the `agent-browser skills` CLI command. ```bash npx skills add vercel-labs/agent-browser ``` -------------------------------- ### Start Session Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/dogfood/SKILL.md Open the target URL in a named session and wait for the network to idle. ```bash agent-browser --session {SESSION} open {TARGET_URL} agent-browser --session {SESSION} wait --load networkidle ``` -------------------------------- ### Install Lightpanda on Linux (x86_64) Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/engines/lightpanda/page.mdx Installs the Lightpanda binary for Linux (x86_64 architecture). Make sure to make the downloaded binary executable and add it to your PATH. ```bash curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux && chmod a+x ./lightpanda ``` -------------------------------- ### Plugin Manifest Response Example Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/plugins/page.mdx Example response when retrieving plugin information using a manifest. It includes the plugin's name, capabilities, and description. ```json { "protocol": "agent-browser.plugin.v1", "success": true, "manifest": { "name": "captcha", "capabilities": ["command.run", "captcha.solve"], "description": "Solve CAPTCHA challenges through Example CAPTCHA" } } ``` -------------------------------- ### Start Video Recording Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Initiates video recording of browser sessions to a WebM file using Playwright. ```bash agent-browser record start ./demo.webm agent-browser click @e1 agent-browser record stop ``` -------------------------------- ### List and Get Agent Browser Skills Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Commands to list available skills, retrieve their content, and find their directory paths. Use `--full` to include references and templates when getting skill content. ```bash agent-browser skills # List available skills agent-browser skills list # Same as above agent-browser skills get # Output a skill's full content agent-browser skills get --full # Include references and templates agent-browser skills get --all # Output every skill agent-browser skills path [name] # Print skill directory path ``` -------------------------------- ### Build Agent Browser from Source Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Builds the agent-browser CLI from source. Requires Node.js 24+, pnpm 11+, and Rust. Includes steps for cloning, installing dependencies, building, linking globally, and installing Chrome. ```bash git clone https://github.com/vercel-labs/agent-browser cd agent-browser pnpm install pnpm build pnpm build:native # Requires Rust (https://rustup.rs) pnpm link --global # Makes agent-browser available globally agent-browser install ``` -------------------------------- ### Initialize Directories Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/dogfood/SKILL.md Create the necessary directory structure for storing screenshots and videos. ```bash mkdir -p {OUTPUT_DIR}/screenshots {OUTPUT_DIR}/videos ``` -------------------------------- ### Batching Agent Browser Commands Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/dogfood/SKILL.md Batch independent agent-browser commands in a single shell call for efficiency, for example, to take a screenshot and then get the console output. ```bash agent-browser ... screenshot ... && agent-browser ... console ``` -------------------------------- ### Create Sandbox Snapshot Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/next/page.mdx Run the helper script to generate a pre-configured VM image for faster startup. ```bash npx tsx scripts/create-snapshot.ts ``` -------------------------------- ### Navigate and Get Snapshot with agent-browser Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/page.mdx Open a website, capture a snapshot of the accessibility tree, and interact with elements using their refs. ```bash # Navigate and get snapshot agent-browser open example.com agent-browser snapshot -i # Output: # - heading "Example Domain" [ref=e1] # - link "More information..." [ref=e2] # Interact using refs agent-browser click @e2 agent-browser screenshot page.png agent-browser close ``` -------------------------------- ### Run Agent Browser Doctor Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Use the doctor command to diagnose your agent-browser installation. Options include running a full diagnosis, a quick local-only check, performing repairs, or getting structured JSON output. ```bash agent-browser doctor agent-browser doctor --offline --quick agent-browser doctor --fix agent-browser doctor --json ``` -------------------------------- ### Batch Pre-Navigation Setup Commands Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/init-scripts/page.mdx Execute a sequence of commands, including opening a blank page, configuring network routes, setting cookies, and navigating to a target URL, before the main page loads. ```bash agent-browser batch \ '["open"]' \ '["network","route","*","--abort","--resource-type","script"]' \ '["cookies","set","--curl","cookies.curl","--domain","localhost"]' \ '["navigate","http://localhost:3000/target"]' ``` -------------------------------- ### AgentCore Session Output Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/providers/agentcore/page.mdx Example of the Live View URL printed to stderr upon session initialization. ```text Session: abc123-def456 Live View: https://us-east-1.console.aws.amazon.com/bedrock-agentcore/browser/aws.browser.v1/session/abc123-def456# ``` -------------------------------- ### Verify Appium Installation Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/ios/page.mdx Check the installed Appium version to confirm the installation was successful. ```bash appium --version ``` -------------------------------- ### Initialize Kernel session via CLI Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/providers/kernel/page.mdx Use the -p flag to specify the provider and open a URL directly. ```bash export KERNEL_API_KEY="your-api-key" agent-browser -p kernel open https://example.com ``` -------------------------------- ### Example Domain Allowlist with CDNs Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/security/page.mdx Include CDN and third-party resource domains in your allowlist to prevent pages from breaking due to blocked sub-resource requests. ```bash --allowed-domains "myapp.com,*.myapp.com,cdn.jsdelivr.net,fonts.googleapis.com,fonts.gstatic.com" ``` -------------------------------- ### List and Show Configured Plugins Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/plugins/page.mdx Verify that a plugin has been successfully added and is configured by listing all plugins or showing the details of a specific plugin. ```bash agent-browser plugin list agent-browser plugin show captcha ``` -------------------------------- ### Start Agent Browser MCP Server Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/SKILL.md Starts the Model Context Protocol (MCP) server for Agent Browser. Supports starting with all tools or specific tool profiles. ```bash agent-browser mcp agent-browser mcp --tools all agent-browser mcp --tools core,network,react ``` -------------------------------- ### React Commands Examples Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/react/page.mdx Demonstrates common agent-browser commands for interacting with React applications, including inspecting the component tree, recording renders, and analyzing Suspense boundaries. ```bash agent-browser react tree agent-browser react inspect 42 agent-browser react renders start agent-browser click @e3 agent-browser react renders stop agent-browser react suspense --only-dynamic ``` -------------------------------- ### Agent Browser Recording Commands Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/video-recording.md Manage video recording sessions using start, stop, and restart commands. Ensure a session is launched before recording. ```bash # Launch a session first agent-browser open # Start recording to file agent-browser record start ./output.webm # Stop current recording agent-browser record stop # Restart with new file (stops current + starts new) agent-browser record restart ./take2.webm ``` -------------------------------- ### Project Installation (Local Dependency) Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Installs Agent Browser as a local dependency for a specific project, allowing version pinning in package.json. Run 'agent-browser install' to download Chrome on the first use. ```bash npm install agent-browser npx agent-browser install # Download Chrome (first time) ``` -------------------------------- ### Cargo Installation (Rust) Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Installs Agent Browser using Cargo, compiling from source. Requires Node.js 24+, pnpm 11+, and the Rust toolchain. Run 'agent-browser install' to download Chrome on the first use. ```bash cargo install agent-browser agent-browser install # Download Chrome (first time) ``` -------------------------------- ### Create a Sandbox Snapshot for Fast Startup Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/vercel-sandbox/SKILL.md This script creates a sandbox snapshot that includes system dependencies, agent-browser, and Chromium. This allows for sub-second sandbox startup times, significantly reducing execution overhead. ```typescript import { Sandbox } from "@vercel/sandbox"; const CHROMIUM_SYSTEM_DEPS = [ "nss", "nspr", "libxkbcommon", "atk", "at-spi2-atk", "at-spi2-core", "libXcomposite", "libXdamage", "libXrandr", "libXfixes", "libXcursor", "libXi", "libXtst", "libXScrnSaver", "libXext", "mesa-libgbm", "libdrm", "mesa-libGL", "mesa-libEGL", "cups-libs", "alsa-lib", "pango", "cairo", "gtk3", "dbus-libs", ]; async function createSnapshot(): Promise { const sandbox = await Sandbox.create({ runtime: "node24", timeout: 300_000, }); await sandbox.runCommand("sh", [ "-c", `sudo dnf clean all 2>&1 && sudo dnf install -y --skip-broken ${CHROMIUM_SYSTEM_DEPS.join(" ")} 2>&1 && sudo ldconfig 2>&1`, ]); await sandbox.runCommand("npm", ["install", "-g", "agent-browser"]); await sandbox.runCommand("npx", ["agent-browser", "install"]); const snapshot = await sandbox.snapshot(); return snapshot.snapshotId; } ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/installation/page.mdx Installs system dependencies required for Agent Browser on Linux systems. ```bash agent-browser install --with-deps ``` -------------------------------- ### Run agent-browser without installation Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/page.mdx Execute agent-browser commands directly using npx without a global installation. ```bash npx agent-browser open example.com ``` -------------------------------- ### Setup Browserless with API Key Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/providers/browserless/page.mdx Use this command to set your Browserless API key and open a URL using the Browserless provider. The -p flag explicitly specifies the provider. ```bash export BROWSERLESS_API_KEY="your-api-token" agent-browser -p browserless open https://example.com ``` -------------------------------- ### Configure Browser Launch Arguments Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Control browser startup with fine-grained options using the `--args`, `--user-agent`, and `--proxy-bypass` flags. ```bash agent-browser --args "--disable-gpu,--no-sandbox" open example.com agent-browser --user-agent "Custom UA" open example.com agent-browser --proxy-bypass "localhost,*.internal" open example.com ``` -------------------------------- ### Connect and Open Slack Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/slack/SKILL.md Initialize a session by connecting to an existing browser instance or opening a new URL. ```bash # Connect to existing session on port 9222 (typical for already-open Slack) agent-browser connect 9222 # Or open Slack if not already running agent-browser open https://app.slack.com ``` -------------------------------- ### Open Channel for Review Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/slack/references/slack-tasks.md Navigates to a channel and captures the initial state. ```bash agent-browser click @e_channel_ref agent-browser wait 1000 agent-browser snapshot -i ``` -------------------------------- ### Optimal AI Workflow: Navigate, Snapshot, and Interact Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md A multi-step workflow demonstrating how to open a website, take an AI-parsable snapshot, and then interact with elements identified by references. ```bash # 1. Navigate and get snapshot agent-browser open example.com agent-browser snapshot -i --json # AI parses tree and refs # 2. AI identifies target refs from snapshot # 3. Execute actions using refs agent-browser click @e2 agent-browser fill @e3 "input text" # 4. Get new snapshot if page changed agent-browser snapshot -i --json ``` -------------------------------- ### Start HAR Export Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/network/page.mdx Begin capturing network traffic for HAR export. Ensure routes are set before starting HAR export if needed. ```bash agent-browser network har start ``` -------------------------------- ### Global Installation of Agent Browser Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Installs the agent-browser CLI globally using npm. Requires a one-time command to download the necessary Chrome browser. ```bash npm install -g agent-browser agent-browser install # Download Chrome from Chrome for Testing (first time only) ``` -------------------------------- ### Launch Browser Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Launches the browser to about:blank. Use this command before other commands like network routing or setting cookies to prepare the browser's initial state. ```bash agent-browser open ``` -------------------------------- ### Generating Documentation with Video Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/video-recording.md Create video recordings of user workflows for documentation purposes. Includes pauses to make the recorded actions easier to follow. ```bash #!/bin/bash # Record workflow for documentation agent-browser open https://app.example.com/login agent-browser record start ./docs/how-to-login.webm agent-browser wait 1000 # Pause for visibility agent-browser snapshot -i agent-browser fill @e1 "demo@example.com" agent-browser wait 500 agent-browser fill @e2 "password" agent-browser wait 500 agent-browser click @e3 agent-browser wait --load networkidle agent-browser wait 1000 # Show result agent-browser record stop ``` -------------------------------- ### Examples of Finding Elements with Actions Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/commands/page.mdx Demonstrates practical usage of the `find` command with various semantic locators and actions. Options like `--name` and `--exact` can refine the search criteria. ```bash agent-browser find role button click --name "Submit" agent-browser find label "Email" fill "test@test.com" agent-browser find alt "Logo" click agent-browser find first ".item" click agent-browser find last ".item" text agent-browser find nth 2 ".card" hover ``` -------------------------------- ### Core Browser Automation Workflow Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/quick-start/page.mdx This sequence demonstrates the fundamental steps: opening a URL, taking a snapshot to identify elements, and interacting with those elements using their references. Re-snapshotting is shown after an interaction. ```bash agent-browser open example.com ``` ```bash agent-browser snapshot -i # Output: # @e1 [heading] "Example Domain" # @e2 [link] "More information..." ``` ```bash agent-browser click @e2 ``` ```bash agent-browser snapshot -i ``` -------------------------------- ### Start and Stop Agent Browser Dashboard Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Commands to start the dashboard server on the default or a custom port, and to stop it. The dashboard runs as a background process. ```bash # Start the dashboard server (runs in background on port 4848) agent-browser dashboard start agent-browser dashboard start --port 8080 # Custom port # All sessions are automatically visible in the dashboard agent-browser open example.com # Stop the dashboard agent-browser dashboard stop ``` -------------------------------- ### Inspect and Navigate an App Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/electron/SKILL.md Pattern for launching, connecting, and navigating through an application's UI. ```bash open -a "Slack" --args --remote-debugging-port=9222 sleep 3 # Wait for app to start agent-browser connect 9222 agent-browser snapshot -i # Read the snapshot output to identify UI elements agent-browser click @e10 # Navigate to a section agent-browser snapshot -i # Re-snapshot after navigation ``` -------------------------------- ### Video Recording Commands Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Record browser interactions as a video. This involves starting a browser session, starting the recording, performing actions, and then stopping the recording. ```bash agent-browser open https://example.com # Launch a browser session first agent-browser record start ./demo.webm # Start recording agent-browser click @e1 # Perform actions agent-browser record stop # Stop and save video agent-browser record restart ./take2.webm # Stop current + start new ``` -------------------------------- ### Start Windows Debugging Instance Source: https://github.com/vercel-labs/agent-browser/blob/main/AGENTS.md Start the Windows Server 2022 EC2 instance if it is stopped. This command is used to make the debugging environment available. ```bash ./scripts/windows-debug/start.sh ``` -------------------------------- ### Login using Credential Plugin Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/plugins/page.mdx This bash command demonstrates how to log in to an application using a specified credential provider and item reference. ```bash agent-browser auth login my-app --credential-provider vault --item "My App" ``` -------------------------------- ### Cargo Installation of Agent Browser Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Installs the agent-browser CLI using Cargo, the Rust package manager. Requires a command to download the necessary Chrome browser. ```bash cargo install agent-browser agent-browser install # Download Chrome from Chrome for Testing (first time only) ``` -------------------------------- ### Start Recording Session Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/dogfood/SKILL.md Initiates a recording session for interactive issue reproduction. Replace {SESSION} with a unique session identifier and {OUTPUT_DIR} with the desired output directory. ```bash agent-browser --session {SESSION} record start {OUTPUT_DIR}/videos/issue-{NNN}-repro.webm ``` -------------------------------- ### Install Lightpanda on macOS (Apple Silicon) Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/engines/lightpanda/page.mdx Installs the Lightpanda binary for macOS with Apple Silicon architecture. Ensure the binary is executable and placed in your system's PATH. ```bash curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-aarch64-macos && chmod a+x ./lightpanda ``` -------------------------------- ### Execute Basic AgentCore Workflow Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/agentcore/SKILL.md Standard commands for opening and interacting with a cloud-hosted browser session. ```bash # Open a page on an AgentCore cloud browser agent-browser -p agentcore open https://example.com # Everything else is the same as local Chrome agent-browser snapshot -i agent-browser click @e1 agent-browser screenshot page.png agent-browser close ``` -------------------------------- ### Project Installation of Agent Browser Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Installs agent-browser as a local dependency for a project, allowing version pinning in package.json. Subsequent use can be via package.json scripts or direct invocation. ```bash npm install agent-browser agent-browser install ``` -------------------------------- ### Launch and Navigate Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Launches the browser and navigates to a specified URL. Supports various protocols and automatically prepends 'https://' if no protocol is provided. ```bash agent-browser open ``` -------------------------------- ### Open URL with Multiple Init Scripts Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/init-scripts/page.mdx Specify multiple `--init-script` flags to run several initialization scripts in sequence before the page loads. ```bash agent-browser --init-script ./a.js --init-script ./b.js open https://example.com ``` -------------------------------- ### Get Snapshot with JSON Output Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Use the `--json` flag to get machine-readable output for the snapshot command. This is useful for parsing the browser's state and element references. ```bash agent-browser snapshot --json # Returns: {"success":true,"data":{"snapshot":"...","refs":{"e1":{"role":"heading","name":"Title"},...}}} ``` -------------------------------- ### Configure Browserbase via CLI flag Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/providers/browserbase/page.mdx Use the -p flag to specify the provider and set the API key directly in the command line. ```bash export BROWSERBASE_API_KEY="your-api-key" agent-browser -p browserbase open https://example.com ``` -------------------------------- ### Implement Server Action for Browser Automation Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/next/page.mdx A server action that manages the sandbox lifecycle, installs dependencies, and executes browser commands. Use a snapshot ID to avoid repeated installation of system dependencies. ```ts "use server"; import { Sandbox } from "@vercel/sandbox"; const snapshotId = process.env.AGENT_BROWSER_SNAPSHOT_ID; const CHROMIUM_SYSTEM_DEPS = [ "nss", "nspr", "libxkbcommon", "atk", "at-spi2-atk", "at-spi2-core", "libXcomposite", "libXdamage", "libXrandr", "libXfixes", "libXcursor", "libXi", "libXtst", "libXScrnSaver", "libXext", "mesa-libgbm", "libdrm", "mesa-libGL", "mesa-libEGL", "cups-libs", "alsa-lib", "pango", "cairo", "gtk3", "dbus-libs", ]; function getSandboxCredentials() { if ( process.env.VERCEL_TOKEN && process.env.VERCEL_TEAM_ID && process.env.VERCEL_PROJECT_ID ) { return { token: process.env.VERCEL_TOKEN, teamId: process.env.VERCEL_TEAM_ID, projectId: process.env.VERCEL_PROJECT_ID, }; } return {}; } async function withBrowser( fn: (sandbox: InstanceType) => Promise, ): Promise { const credentials = getSandboxCredentials(); const sandbox = snapshotId ? await Sandbox.create({ ...credentials, source: { type: "snapshot", snapshotId }, timeout: 120_000, }) : await Sandbox.create({ ...credentials, runtime: "node24", timeout: 120_000 }); if (!snapshotId) { await sandbox.runCommand("sh", [ "-c", `sudo dnf clean all 2>&1 && sudo dnf install -y --skip-broken ${CHROMIUM_SYSTEM_DEPS.join(" ")} 2>&1 && sudo ldconfig 2>&1`, ]); await sandbox.runCommand("npm", ["install", "-g", "agent-browser"]); await sandbox.runCommand("npx", ["agent-browser", "install"]); } try { return await fn(sandbox); } finally { await sandbox.stop(); } } export async function screenshotUrl(url: string) { return withBrowser(async (sandbox) => { await sandbox.runCommand("agent-browser", ["open", url]); const ssResult = await sandbox.runCommand("agent-browser", [ "screenshot", "--json", ]); const ssPath = JSON.parse(await ssResult.stdout())?.data?.path; const b64Result = await sandbox.runCommand("base64", ["-w", "0", ssPath]); const screenshot = (await b64Result.stdout()).trim(); await sandbox.runCommand("agent-browser", ["close"]); return { ok: true, screenshot }; }); } export async function snapshotUrl(url: string) { return withBrowser(async (sandbox) => { await sandbox.runCommand("agent-browser", ["open", url]); const result = await sandbox.runCommand("agent-browser", [ "snapshot", "-i", "-c", ]); const snapshot = await result.stdout(); await sandbox.runCommand("agent-browser", ["close"]); return { ok: true, snapshot }; }); } ``` -------------------------------- ### Login with Credential Provider Plugin Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Use a credential provider plugin for authentication. This example shows a basic login and a more detailed login with specific selectors and URL. ```bash agent-browser auth login my-app --credential-provider vault --item "My App" agent-browser auth login my-app --credential-provider vault --item "My App" --url https://app.example.com/login --username-selector "#email" --password-selector "#password" --submit-selector "button[type=submit]" ``` -------------------------------- ### Capture Chrome DevTools Traces Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/debugging/page.mdx Start a Chrome DevTools trace with `trace start`. End tracing and save the trace data to a JSON file using `trace stop [path]`. If no path is specified, a file is saved in the temp directory. ```bash agent-browser trace start agent-browser open https://example.com agent-browser click @e3 agent-browser trace stop ./trace.json ``` -------------------------------- ### Chrome Trace Event Format Example Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/profiler/page.mdx This is an example of the JSON output generated by the profiler, conforming to the Chrome Trace Event format. It includes trace events with details like category, name, timestamp, duration, process ID, and thread ID. ```json { "traceEvents": [ { "cat": "devtools.timeline", "name": "RunTask", "ph": "X", "ts": 12345, "dur": 100, "pid": 1, "tid": 1 } ], "metadata": { "clock-domain": "LINUX_CLOCK_MONOTONIC" } } ``` -------------------------------- ### Run Snapshot Creation Script Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/vercel-sandbox/SKILL.md Execute the helper script to create a sandbox snapshot. This command simplifies the process of setting up the environment for fast startup. ```bash npx tsx examples/environments/scripts/create-snapshot.ts ``` -------------------------------- ### Get Text Content Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/slack/SKILL.md Retrieve the text content of a specific element. ```bash # Get a message or element's text agent-browser get text @e_message_ref ``` -------------------------------- ### Enable Native Rust Daemon Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Demonstrates how to enable the experimental native Rust daemon for Agent Browser using command-line flags, environment variables, or configuration files. ```bash # Via flag agent-browser --native open example.com # Via environment variable export AGENT_BROWSER_NATIVE=1 agent-browser open example.com ``` -------------------------------- ### Validate session names Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/sessions/page.mdx Examples of valid and invalid session name formats. ```bash # Valid session names agent-browser --session-name my-project open example.com agent-browser --session-name test_session_v2 open example.com # Invalid (will be rejected) agent-browser --session-name "../bad" open example.com # path traversal agent-browser --session-name "my session" open example.com # spaces agent-browser --session-name "foo/bar" open example.com # slashes ``` -------------------------------- ### Install Vercel Sandbox dependency Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/next/page.mdx Add the required Vercel Sandbox package to your project. ```bash pnpm add @vercel/sandbox ``` -------------------------------- ### Color Scheme and Download Options Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/commands/page.mdx Options for setting the color scheme and default download directory. Use '--color-scheme' to specify 'dark', 'light', or 'no-preference'. ```bash --color-scheme # Color scheme: dark, light, no-preference --download-path # Default download directory ``` -------------------------------- ### Snapshot ID Environment Variable Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/next/page.mdx Example format for the snapshot ID environment variable. ```text AGENT_BROWSER_SNAPSHOT_ID=snap_xxxxxxxxxxxx ``` -------------------------------- ### Run Context Footprint Measurement Source: https://github.com/vercel-labs/agent-browser/blob/main/evals/README.md Execute the deterministic CLI vs MCP context footprint measurement. ```bash bun run context-footprint.ts ``` -------------------------------- ### Get Element Styles Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Retrieves the computed styles of elements matching a given selector. ```bash agent-browser get styles "button" ``` -------------------------------- ### Connect to Cloud Browser Provider Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/cdp-mode/page.mdx Use the -p flag to connect to a cloud browser provider instead of launching a local browser. This example connects to Browserbase. ```bash agent-browser -p browserbase open https://example.com ``` -------------------------------- ### Restart Video Recording Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/commands/page.mdx Command to stop the current video recording and start a new one. ```bash agent-browser record restart # Stop current and start new recording ``` -------------------------------- ### Result Event Structure Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/dashboard/page.mdx Example JSON structure for a result event sent when a command finishes. ```json { "type": "result", "id": "r123", "action": "click", "success": true, "data": {}, "duration_ms": 45, "timestamp": 1711367000045 } ``` -------------------------------- ### Set Default Download Path Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/changelog/page.mdx Opens a URL with a specified download path. Downloads will be saved to './downloads'. ```bash agent-browser --download-path ./downloads open https://example.com ``` -------------------------------- ### Start and Stop Tracing Source: https://github.com/vercel-labs/agent-browser/blob/main/README.md Use these commands to begin and end the recording of execution traces for debugging purposes. ```bash agent-browser trace start # Start recording trace agent-browser trace stop [path] # Stop and save trace ``` -------------------------------- ### Workflow with Labeled Tabs and Actions Source: https://github.com/vercel-labs/agent-browser/blob/main/skill-data/core/references/commands.md Demonstrates a workflow using user-assigned labels for tabs, including creating labeled tabs, switching between them, and performing actions like clicking elements. ```bash agent-browser tab new --label docs https://docs.example.com agent-browser tab new --label app https://app.example.com agent-browser tab docs # switch to docs agent-browser snapshot # populate refs for docs agent-browser click @e1 # ref click on docs agent-browser tab app # switch to app agent-browser tab close docs # close by label ``` -------------------------------- ### List Available iOS Simulators Source: https://github.com/vercel-labs/agent-browser/blob/main/docs/src/app/ios/page.mdx Use this command to see all iOS simulators available on your system, including their names and iOS versions. ```bash agent-browser device list ```