Skip to content

使用 agent-browser.json 设置持久默认值。

创建 agent-browser.json 文件,可以设置持久默认值,避免每次命令都重复传 flags。

优先级位置范围
1(最低)~/.agent-browser/config.json用户级默认值
2./agent-browser.json项目级覆盖
3AGENT_BROWSER_* 环境变量覆盖配置值
4(最高)CLI flags覆盖所有内容

也可以用 --config <path>AGENT_BROWSER_CONFIG 加载指定配置:

Terminal window
agent-browser --config ./ci-config.json open example.com
AGENT_BROWSER_CONFIG=./ci-config.json agent-browser open example.com
{
"headed": true,
"proxy": "http://localhost:8080",
"profile": "./browser-data",
"userAgent": "my-agent/1.0",
"ignoreHttpsErrors": true
}

可通过 $schema 开启 IDE 自动补全:

{
"$schema": "https://agent-browser.dev/schema.json",
"headed": true
}
{
"headed": true,
"profile": "./browser-data"
}
{
"proxy": "http://proxy.corp.example.com:8080",
"proxyBypass": "localhost,*.internal.com",
"ignoreHttpsErrors": true
}
{
"args": "--no-sandbox,--disable-gpu",
"ignoreHttpsErrors": true
}
{
"contentBoundaries": true,
"maxOutput": 50000,
"allowedDomains": ["your-app.com", "*.your-app.com"],
"actionPolicy": "./policy.json"
}

布尔 flags 可传可选的 true / false

Terminal window
agent-browser --headed false open example.com

裸 flag 等价于 true

-
0:000:00