# Configuration Create an `agent-browser.json` file to set persistent defaults instead of repeating flags on every command. ## Config File Locations agent-browser checks two locations, merged in priority order:
PriorityLocationScope
1 (lowest)~/.agent-browser/config.jsonUser-level defaults
2./agent-browser.jsonProject-level overrides
3AGENT_BROWSER_* env varsOverride config values
4 (highest)CLI flagsOverride everything
Project-level values override user-level values. Environment variables override both. CLI flags always win. Use `--config ` or the `AGENT_BROWSER_CONFIG` environment variable to load a specific config file instead of the default locations: ```bash agent-browser --config ./ci-config.json open example.com AGENT_BROWSER_CONFIG=./ci-config.json agent-browser open example.com ``` ## Example Config ```json { "headed": true, "proxy": "http://localhost:8080", "profile": "./browser-data", "userAgent": "my-agent/1.0", "ignoreHttpsErrors": true } ``` ## All Options Every CLI flag can be set in the config file using its camelCase equivalent:
Config KeyCLI FlagType
headed--headedboolean
json--jsonboolean
full--full, -fboolean
debug--debugboolean
session--sessionstring
sessionName--session-namestring
executablePath--executable-pathstring
extensions--extensionstring[]
profile--profilestring
state--statestring
proxy--proxystring
proxyBypass--proxy-bypassstring
args--argsstring
userAgent--user-agentstring
provider-p, --providerstring
device--devicestring
ignoreHttpsErrors--ignore-https-errorsboolean
allowFileAccess--allow-file-accessboolean
cdp--cdpstring
autoConnect--auto-connectboolean
colorScheme--color-schemestring (dark, light, no-preference)
downloadPath--download-pathstring
contentBoundaries--content-boundariesboolean
maxOutput--max-outputnumber
allowedDomains--allowed-domainsstring[]
actionPolicy--action-policystring
confirmActions--confirm-actionsstring
confirmInteractive--confirm-interactiveboolean
engine--enginestring (chrome, lightpanda)
headers--headersstring (JSON)
## Common Configurations ### Local Development ```json { "headed": true, "profile": "./browser-data" } ``` ### Behind a Proxy ```json { "proxy": "http://proxy.corp.example.com:8080", "proxyBypass": "localhost,*.internal.com", "ignoreHttpsErrors": true } ``` ### CI / Devcontainer ```json { "args": "--no-sandbox,--disable-gpu", "ignoreHttpsErrors": true } ``` ### iOS Testing ```json { "provider": "ios", "device": "iPhone 16 Pro" } ``` ### AI Agent Security ```json { "contentBoundaries": true, "maxOutput": 50000, "allowedDomains": ["your-app.com", "*.your-app.com"], "actionPolicy": "./policy.json" } ``` ## Overriding Boolean Options Boolean flags accept an optional `true`/`false` value to override config settings: ```bash agent-browser --headed false open example.com ``` A bare flag is equivalent to passing `true`: ```bash agent-browser --headed open example.com # same as --headed true agent-browser --headed true open example.com # explicit ``` This applies to all boolean flags: `--headed`, `--debug`, `--json`, `--ignore-https-errors`, `--allow-file-access`, `--auto-connect`, `--content-boundaries`, `--confirm-interactive`. ## Extensions Merging Extensions from user-level and project-level configs are **concatenated**, not replaced. For example, if `~/.agent-browser/config.json` specifies `["/ext1"]` and `./agent-browser.json` specifies `["/ext2"]`, the result is `["/ext1", "/ext2"]`. The `AGENT_BROWSER_EXTENSIONS` environment variable and CLI `--extension` flags follow the standard priority rules (env replaces config, CLI appends). ## Environment Variables These environment variables configure additional daemon and runtime behavior:
VariableDescriptionDefault
AGENT_BROWSER_AUTO_CONNECTAuto-discover and connect to a running Chrome instance.(disabled)
AGENT_BROWSER_ALLOW_FILE_ACCESSAllow file:// URLs to access local files.(disabled)
AGENT_BROWSER_COLOR_SCHEMEColor scheme preference (dark, light, no-preference).(none)
AGENT_BROWSER_DOWNLOAD_PATHDefault directory for browser downloads.(temp directory)
AGENT_BROWSER_DEFAULT_TIMEOUTDefault timeout in ms. Keep below 30000 to avoid IPC timeouts.25000
AGENT_BROWSER_SESSION_NAMEAuto-save/load state persistence name.(none)
AGENT_BROWSER_STATE_EXPIRE_DAYSAuto-delete saved session states older than N days.30
AGENT_BROWSER_ENCRYPTION_KEY64-char hex key for AES-256-GCM session encryption.(none)
AGENT_BROWSER_EXTENSIONSComma-separated browser extension paths. Extensions work in both headed and headless mode.(none)
AGENT_BROWSER_HEADEDShow browser window instead of running headless (1 to enable).(disabled)
AGENT_BROWSER_STREAM_PORTOverride the WebSocket streaming port. By default, an OS-assigned port is used. Set this to bind to a specific port (e.g., 9223).OS-assigned
AGENT_BROWSER_IDLE_TIMEOUT_MSAuto-shutdown the daemon after N ms of inactivity (no commands received). Useful for ephemeral environments.(disabled)
AGENT_BROWSER_IOS_DEVICEDefault iOS device name for the ios provider.(none)
AGENT_BROWSER_IOS_UDIDDefault iOS device UDID for the ios provider.(none)
AGENT_BROWSER_DEBUGEnable debug output (1 to enable).(disabled)
AGENT_BROWSER_CONTENT_BOUNDARIESWrap page output in boundary markers for LLM safety.(disabled)
AGENT_BROWSER_MAX_OUTPUTMax characters for page output (truncates beyond limit).(unlimited)
AGENT_BROWSER_ALLOWED_DOMAINSComma-separated allowed domain patterns (e.g., example.com,*.example.com).(unrestricted)
AGENT_BROWSER_ACTION_POLICYPath to action policy JSON file.(none)
AGENT_BROWSER_CONFIRM_ACTIONSComma-separated action categories requiring confirmation.(none)
AGENT_BROWSER_CONFIRM_INTERACTIVEEnable interactive confirmation prompts (auto-denies if stdin is not a TTY).(disabled)
AGENT_BROWSER_ENGINEBrowser engine to use: chrome (default), lightpanda.chrome
## Error Handling - **Auto-discovered config files** (`~/.agent-browser/config.json`, `./agent-browser.json`) that are missing are silently ignored. - **`--config `** with a missing or malformed file exits with an error. - **Malformed JSON** in auto-discovered files prints a warning to stderr and continues without that file. - **Unknown keys** are silently ignored for forward compatibility. > **Tip:** If your project-level `agent-browser.json` contains environment-specific values (paths, proxies), consider adding it to `.gitignore`.