Skip to main content

CLI Usage

The browsernode-cli command-line interface provides multiple modes of operation for browser automation.

Installation

Get started with browsernode-cli immediately using npx:

Modes of Operation

1. Interactive TUI Mode (Default)

Launch an interactive terminal UI where you can chat with the browser automation agent:
This opens a chat interface where you can:
  • Type natural language commands to control the browser
  • See real-time feedback from the agent
  • View browser state and actions being performed

2. One-Shot Mode

Execute a single task without entering interactive mode:
Options:
  • -p, --prompt: The task to execute
  • --headless: Run browser in headless mode
  • --model: Specify LLM model (default: gpt-4o)

Configuration

Browsernode can be configured through environment variables and a configuration file.

Configuration File Location

The default configuration file is located at:
  • ~/.config/browsernode/config.json
You can override this location with:
  • BROWSERNODE_CONFIG_PATH environment variable
  • BROWSERNODE_CONFIG_DIR environment variable (directory containing config.json)

Configuration File Format

The configuration uses a database-style format with UUID entries:
Each configuration type (browserProfile, llm, agent) can have multiple entries, with one marked as default: true.

Environment Variables

Environment variables always override config.json values:

General Settings

  • BROWSERNODE_LOGGING_LEVEL: Logging level (debug, info, warning, error)
  • BROWSERNODE_CONFIG_PATH: Full path to config.json file
  • BROWSERNODE_CONFIG_DIR: Directory containing config.json

Browser Profile Settings

  • BROWSERNODE_HEADLESS: Run browser in headless mode (true/false)
  • BROWSERNODE_ALLOWED_DOMAINS: Comma-separated list of allowed domains
  • BROWSERNODE_USER_DATA_DIR: Chrome user data directory path

LLM Settings

  • OPENAI_API_KEY: OpenAI API key
  • ANTHROPIC_API_KEY: Anthropic API key
  • BROWSERNODE_LLM_MODEL: LLM model to use (e.g., gpt-4o, claude-3-opus)

MCP-Specific Settings

When running in MCP mode, these environment variables are particularly useful:
  • BROWSERNODE_HEADLESS: Control browser visibility
  • OPENAI_API_KEY: Required for agent-based tools

Browser Profiles Directory

Browser profiles are stored in:
Each profile directory contains Chrome user data, allowing you to:
  • Maintain separate browser sessions
  • Keep cookies and local storage isolated
  • Use different extensions per profile

Examples

Basic Usage

With Configuration

Troubleshooting

Common Issues

  1. Browser not launching: Ensure Chrome/Chromium is installed
  2. API key errors: Set appropriate API key environment variables
  3. Permission errors: Check file permissions in ~/.config/browsernode/

Debug Mode

Enable debug logging for troubleshooting:

See Also