Overview
Create anagent-browser.json file to set persistent defaults instead of repeating flags on every command. Configuration files use a priority-based system where CLI flags always take precedence.
Configuration Precedence
Settings are loaded in the following order (lowest to highest priority):| Priority | Location | Description |
|---|---|---|
| 1 (lowest) | ~/.agent-browser/config.json | User-level defaults |
| 2 | ./agent-browser.json | Project-level overrides (in working directory) |
| 3 | AGENT_BROWSER_* environment variables | Environment-specific overrides |
| 4 (highest) | CLI flags | Command-specific overrides |
Custom Config Files
Use--config <path> or the AGENT_BROWSER_CONFIG environment variable to load a specific config file instead of the default locations:
- If the file is missing or invalid, agent-browser exits with an error
- Auto-discovered config files (
~/.agent-browser/config.json,./agent-browser.json) are still loaded if they exist - The custom config file has priority between project config and environment variables
Config File Format
All CLI options can be set in the config file using camelCase keys. For example,--executable-path becomes "executablePath", and --proxy-bypass becomes "proxyBypass".
Example Config
src/daemon.ts:434-481 for the complete list of environment variables that map to config options.
Available Options
| Config Key | CLI Flag | Type | Description |
|---|---|---|---|
headed | —headed | boolean | Show browser window (not headless) |
profile | —profile | string | Persistent browser profile directory |
executablePath | —executable-path | string | Custom browser executable path |
extensions | —extension | string[] | Browser extension paths (repeatable) |
args | —args | string[] | Browser launch arguments |
userAgent | —user-agent | string | Custom User-Agent string |
proxy | —proxy | string | Proxy server URL |
proxyBypass | —proxy-bypass | string | Hosts to bypass proxy |
ignoreHttpsErrors | —ignore-https-errors | boolean | Ignore HTTPS certificate errors |
allowFileAccess | —allow-file-access | boolean | Allow file:// URL access (Chromium only) |
colorScheme | —color-scheme | string | Color scheme: dark, light, no-preference |
downloadPath | —download-path | string | Default download directory |
allowedDomains | —allowed-domains | string[] | Allowed domain patterns (security) |
actionPolicy | —action-policy | string | Path to action policy JSON file |
confirmActions | —confirm-actions | string | Action categories requiring confirmation |
contentBoundaries | —content-boundaries | boolean | Wrap page output in boundary markers |
maxOutput | —max-output | number | Max characters for page output |
Boolean Flags
Boolean flags accept an optionaltrue/false value to override config settings:
Extension Merging
Extensions from user and project configs are concatenated, not replaced. For example:~/.agent-browser/config.jsonspecifies["extensions": ["/ext1"]./agent-browser.jsonspecifies"extensions": ["/ext2"]- Result:
["/ext1", "/ext2"]
Environment Variables
All config options can also be set via environment variables using theAGENT_BROWSER_ prefix:
1 for true and 0 for false. See the README for the complete list of environment variables.
Config File Validation
- Auto-discovered config files (
~/.agent-browser/config.json,./agent-browser.json) that are missing are silently ignored. - Explicitly specified config files (via
--configorAGENT_BROWSER_CONFIG) must exist and be valid JSON, or agent-browser exits with an error. - Unknown keys in config files are ignored for forward compatibility.
Use Cases
User-Level Defaults
Create~/.agent-browser/config.json for settings you want across all projects:
Project-Level Overrides
Create./agent-browser.json in your project for project-specific settings:
agent-browser.json to .gitignore if it contains environment-specific values like paths or proxies.
CI/CD Config
Use a separate config file for CI environments:Security Considerations
Configuration files may contain sensitive settings like:- Proxy credentials in
proxyfield - Custom headers in
headersfield - Download paths that expose directory structure