Environment Variables
Agent Browser can be configured using environment variables as an alternative to CLI flags. Environment variables take precedence over config files but are overridden by CLI flags.Session Management
Variables for managing browser sessions and state.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_SESSION | Default session name (equivalent to —session) | AGENT_BROWSER_SESSION=mysession |
AGENT_BROWSER_SESSION_NAME | Auto-save/load state persistence name | AGENT_BROWSER_SESSION_NAME=twitter |
AGENT_BROWSER_PROFILE | Persistent browser profile directory | AGENT_BROWSER_PROFILE=~/.myapp-profile |
AGENT_BROWSER_STATE | Path to storage state JSON file | AGENT_BROWSER_STATE=./auth-state.json |
AGENT_BROWSER_STATE_EXPIRE_DAYS | Auto-delete states older than N days (default: 30) | AGENT_BROWSER_STATE_EXPIRE_DAYS=7 |
Browser Configuration
Variables for configuring the browser instance.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_HEADED | Show browser window (set to 1 to enable) | AGENT_BROWSER_HEADED=1 |
AGENT_BROWSER_EXECUTABLE_PATH | Custom browser executable path | AGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium |
AGENT_BROWSER_EXTENSIONS | Comma-separated extension paths | AGENT_BROWSER_EXTENSIONS=/ext1,/ext2 |
AGENT_BROWSER_ARGS | Browser launch arguments (comma or newline separated) | AGENT_BROWSER_ARGS=—no-sandbox,—disable-gpu |
AGENT_BROWSER_USER_AGENT | Custom User-Agent string | AGENT_BROWSER_USER_AGENT=“MyBot/1.0” |
AGENT_BROWSER_COLOR_SCHEME | Color scheme: dark, light, no-preference | AGENT_BROWSER_COLOR_SCHEME=dark |
AGENT_BROWSER_IGNORE_HTTPS_ERRORS | Ignore HTTPS certificate errors (set to 1 to enable) | AGENT_BROWSER_IGNORE_HTTPS_ERRORS=1 |
AGENT_BROWSER_ALLOW_FILE_ACCESS | Allow file:// URLs to access local files (set to 1 to enable) | AGENT_BROWSER_ALLOW_FILE_ACCESS=1 |
Network Configuration
Variables for network settings.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_PROXY | Proxy server URL with optional auth | AGENT_BROWSER_PROXY=http://user:pass@proxy:8080 |
AGENT_BROWSER_PROXY_BYPASS | Comma-separated hosts to bypass proxy | AGENT_BROWSER_PROXY_BYPASS=localhost,127.0.0.1 |
Cloud Providers
Variables for cloud browser providers.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_PROVIDER | Cloud browser provider: browserbase, browseruse, kernel, ios | AGENT_BROWSER_PROVIDER=browserbase |
BROWSERBASE_API_KEY | Browserbase API key | BROWSERBASE_API_KEY=your-api-key |
BROWSERBASE_PROJECT_ID | Browserbase project ID | BROWSERBASE_PROJECT_ID=your-project-id |
BROWSER_USE_API_KEY | Browser Use API key | BROWSER_USE_API_KEY=your-api-key |
KERNEL_API_KEY | Kernel API key | KERNEL_API_KEY=your-api-key |
KERNEL_HEADLESS | Run Kernel browser in headless mode (true/false) | KERNEL_HEADLESS=false |
KERNEL_STEALTH | Enable Kernel stealth mode (true/false) | KERNEL_STEALTH=true |
KERNEL_TIMEOUT_SECONDS | Kernel session timeout in seconds | KERNEL_TIMEOUT_SECONDS=300 |
KERNEL_PROFILE_NAME | Kernel browser profile name for persistent state | KERNEL_PROFILE_NAME=my-profile |
iOS Provider
Variables for iOS simulator/device control.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_IOS_DEVICE | iOS device name (e.g., “iPhone 15 Pro”, “iPad Pro”) | AGENT_BROWSER_IOS_DEVICE=“iPhone 16 Pro” |
AGENT_BROWSER_IOS_UDID | iOS device UDID (alternative to device name) | AGENT_BROWSER_IOS_UDID=12345678-ABCD… |
CDP Connection
Variables for Chrome DevTools Protocol.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_AUTO_CONNECT | Auto-discover and connect to running Chrome (set to 1 to enable) | AGENT_BROWSER_AUTO_CONNECT=1 |
Security
Variables for security features.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_CONTENT_BOUNDARIES | Wrap page output in boundary markers (set to 1 to enable) | AGENT_BROWSER_CONTENT_BOUNDARIES=1 |
AGENT_BROWSER_MAX_OUTPUT | Truncate page output to N characters | AGENT_BROWSER_MAX_OUTPUT=50000 |
AGENT_BROWSER_ALLOWED_DOMAINS | Comma-separated allowed domain patterns | AGENT_BROWSER_ALLOWED_DOMAINS=“example.com,*.example.com” |
AGENT_BROWSER_ACTION_POLICY | Path to action policy JSON file | AGENT_BROWSER_ACTION_POLICY=./policy.json |
AGENT_BROWSER_CONFIRM_ACTIONS | Action categories requiring confirmation (comma-separated) | AGENT_BROWSER_CONFIRM_ACTIONS=eval,download |
AGENT_BROWSER_CONFIRM_INTERACTIVE | Enable interactive confirmation prompts (set to 1 to enable) | AGENT_BROWSER_CONFIRM_INTERACTIVE=1 |
AGENT_BROWSER_ENCRYPTION_KEY | 64-character hex key for AES-256-GCM encryption of saved states | AGENT_BROWSER_ENCRYPTION_KEY=$(openssl rand -hex 32) |
Output Configuration
Variables for output formatting.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_JSON | Output as JSON (set to 1 to enable) | AGENT_BROWSER_JSON=1 |
AGENT_BROWSER_DEBUG | Enable debug output (set to 1 to enable) | AGENT_BROWSER_DEBUG=1 |
AGENT_BROWSER_ANNOTATE | Annotated screenshots with numbered element labels (set to 1 to enable) | AGENT_BROWSER_ANNOTATE=1 |
AGENT_BROWSER_FULL | Full page screenshots (set to 1 to enable) | AGENT_BROWSER_FULL=1 |
Download Configuration
Variables for download behavior.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_DOWNLOAD_PATH | Default download directory | AGENT_BROWSER_DOWNLOAD_PATH=/tmp/downloads |
Timeouts
Variables for timeout configuration.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_DEFAULT_TIMEOUT | Default Playwright timeout in milliseconds (default: 25000) | AGENT_BROWSER_DEFAULT_TIMEOUT=45000 |
Streaming
Variables for browser streaming.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_STREAM_PORT | WebSocket streaming port for live browser preview | AGENT_BROWSER_STREAM_PORT=9223 |
Configuration File
Variables for loading configuration.| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_CONFIG | Path to custom config file | AGENT_BROWSER_CONFIG=./custom-config.json |
Internal Variables
These variables are used internally and typically should not be set manually.| Variable | Description | Notes |
|---|---|---|
AGENT_BROWSER_SOCKET_DIR | Custom socket directory for daemon IPC | Advanced use only. Defaults to XDG_RUNTIME_DIR or ~/.agent-browser |
AGENT_BROWSER_DAEMON | Internal flag to indicate daemon mode | Set automatically by the daemon process |
Boolean Values
For boolean environment variables, the following values are considered truthy:- Any non-empty value except
0,false, orno(case-insensitive)
Priority Order
Configuration sources are applied in this order (lowest to highest priority):~/.agent-browser/config.json(user-level defaults)./agent-browser.json(project-level overrides)- Environment variables
- CLI flags