Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

Browser Bridge

Connect Autohand Code CLI to the Autohand browser extension so the agent can navigate pages, fill forms, take screenshots, and read console and network activity from your terminal.

Overview

The browser bridge connects Autohand Code CLI to the Autohand extension in a Chromium browser. Once connected, the agent can navigate pages, click and type, fill forms, capture screenshots, read console messages and network requests, and work across tabs, all from a session you started in the terminal.

It works with Chrome, Chromium, Brave, and Microsoft Edge.

How it works

The CLI and the extension talk through the browser’s native messaging protocol.

  1. /browser installs a native messaging host, a small Node.js bridge at ~/.autohand/chrome/native-host/host.js.
  2. The CLI writes a handoff token for the current session to ~/.autohand/chrome/handoffs/.
  3. The browser opens with the Autohand side panel, and the extension attaches to the session using that token.
  4. The native host starts Autohand in RPC mode and forwards JSON-RPC 2.0 messages between the extension and the agent.
  5. The extension runs browser tools on the active tab and returns the results to the agent.

Set up

Install the extension

Install the Autohand browser extension in Chrome, Chromium, Brave, or Edge.

Connect from the CLI

Start Autohand Code CLI and run /browser:

autohand
/browser

Choose Open in Chrome. Autohand installs the native messaging host if needed, creates a handoff token for the current session, and opens your browser with the Autohand side panel.

Work from either side

The extension attaches to your CLI session. Ask the agent to work with the page from the terminal or from the side panel.

To install the native host without opening the panel, run the browser install command:

autohand browser install --browser chrome --extension-id <extension-id> --open
Option Behavior
--browser <name> chrome, chromium, brave, edge, or all. Default all.
--extension-id <id> The installed extension ID used for direct handoff. Saved to your config.
--install-url <url> Fallback install or continue page.
--cli-path <path> The Autohand binary to register in the native host.
--open Opens the install or continue page after installing.

If no extension ID is configured, open the extension’s options page, copy the pairing command it shows, and run it.

The /browser panel

Running /browser shows the bridge status and a menu.

Status Meaning
Handoff pending A handoff token is waiting for the extension to attach.
Extension ready The native host is installed and the extension was found in your browser profile.
Native host installed The native host is installed, but the extension was not detected.
Not installed The native host is not installed yet.
Menu option What it does
Open in Chrome Creates a handoff and opens the browser.
Manage permissions Opens the extension settings page.
Reconnect extension Reinstalls the native messaging host.
Enabled by default Toggles whether the bridge starts with the CLI.

Commands and flags

Command or flag Behavior
/browser Opens the browser panel.
/browser disconnect Closes the bridge and turns off Enabled by default.
autohand --browser Starts the CLI with the bridge enabled.
autohand --no-browser Starts the CLI with the bridge disabled.

To reconnect after the CLI or browser restarts, run /browser again and choose Open in Chrome to create a new handoff. You can also disconnect from the side panel. Closing the panel only hides the UI and does not stop a browser tool that is still running.

Browser tools

When the bridge is connected, the agent can use these tools on the active tab.

Tool Description
browser_navigate Opens a URL.
browser_click Clicks an element.
browser_type Types text into an input.
browser_press_key Sends a key such as Enter or Escape.
browser_scroll Scrolls the page or to an element.

Reading and inspection

Tool Description
browser_get_page_context Returns the page title, URL, headings, metadata, and body text.
browser_get_element Returns an element’s computed styles, position, and attributes.
browser_find_element Finds elements by selector, text, or ARIA role.
browser_wait_for_element Waits for an element to appear. Default timeout 5 seconds.
browser_screenshot Captures the visible page. Pass save: true to also download a PNG.
browser_take_full_page_screenshot Captures the entire page, including content outside the viewport. Pass save: true to also download a PNG.

Debugging

Tool Description
browser_read_console Reads captured console messages.
browser_read_network Reads captured network requests, filtered by URL, method, or status.
browser_get_tabs Lists open tabs.
browser_get_tab_groups Lists tab groups and their tabs.

Example requests:

> Read the console errors on this page
> What network requests are failing?
> Fill in the login form with test@example.com
> Take a full-page screenshot

Reliable browser tools (V2)

Browser tools V2 add snapshot references, typed waits, and dedicated form tools. They are experimental and off by default. Enable them, then restart the CLI:

autohand experiments enable experimental_browser_tools_v2

Or set it in ~/.autohand/config.json:

{
  "features": {
    "experimentalBrowserToolsV2": true
  }
}

V2 turns on only when both the CLI and the extension support browser protocol version 2. If either side is older, the agent keeps using the tools above.

Target elements with snapshots

  1. browser_snapshot returns the page structure with an opaque ref for each element. The agent acts with that ref and falls back to a CSS selector or role and name only when needed.
  2. browser_wait_for waits for an element, text, value, URL, page load, or network-idle condition. Waits default to 10 seconds and are capped at 25 seconds.
  3. Refs belong to one tab, frame, and document. After navigation, or if a ref is reported as stale or ambiguous, the agent takes a new snapshot instead of retrying.

Fill forms

The agent works through forms in four steps: browser_inspect_form, browser_fill_form, browser_validate_form, then browser_submit_form.

  • browser_fill_form fills fields one at a time and never submits.
  • browser_submit_form validates first and submits once. An ambiguous submission is not retried.
  • browser_reset_form clears a form.

Other V2 tools

Area Tools
Navigation browser_go_back, browser_go_forward, browser_reload
Tabs browser_open_tab, browser_close_tab, browser_switch_tab, browser_group_tabs
Interaction browser_hover, browser_drag, browser_select_option, browser_upload_file, browser_handle_dialog
Reading browser_read_page_interactive, browser_read_page_all, browser_get_selected_text, browser_extract_links, browser_get_runtime_state
Downloads browser_wait_for_download

Safety

  • Submitting or resetting a form, uploading a file, and handling a dialog ask for approval in interactive mode. YOLO mode and Automode keep their existing approval behavior.
  • Passwords, one-time codes, payment fields, API keys, and other secret-like values are redacted from tool results and events.
  • Upload paths are resolved by the CLI, and results show only file names.
  • V2 does not add credential storage, payment autofill, CAPTCHA bypass, arbitrary JavaScript execution, arbitrary sleeps, or blind retries.

Configuration

Add a chrome block to ~/.autohand/config.json:

{
  "chrome": {
    "extensionId": "your-extension-id",
    "enabledByDefault": false,
    "browser": "auto",
    "userDataDir": "/path/to/browser/user-data",
    "profileDirectory": "Default"
  }
}
Key Type Default Description
extensionId string none Extension ID used for direct handoff.
enabledByDefault boolean false Starts the bridge automatically with the CLI.
browser string "auto" Preferred browser: auto, chrome, chromium, brave, or edge. auto tries Chrome, Edge, Brave, then Chromium.
userDataDir string none Browser user data directory for the profile to open.
profileDirectory string none Profile directory name, such as Default or Profile 1.
installUrl string none Fallback page when no extension ID is set.

See Configuration for the rest of the config file.

Permissions

Browser tools follow the CLI’s permission mode, the same as any other tool. Site access is limited by the host permissions granted to the extension in your browser.

Troubleshooting

Problem What to do
Status is Not installed Run /browser and choose Reconnect extension, or run autohand browser install.
Status is Native host installed Install the extension, or set chrome.extensionId so Autohand can find it in your profile.
The extension cannot find the CLI Make sure autohand is on your PATH, or reinstall the host with autohand browser install --cli-path <path>.
The connection dropped Run /browser and choose Open in Chrome to create a new handoff.
V2 tools do not appear Enable experimental_browser_tools_v2, restart the CLI, and update the extension.

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification