Action Policies
Action policies provide fine-grained control over what actions an AI agent can perform. Use static policy files to gate destructive actions or require explicit confirmation for sensitive operations.Quick Start
Policy File Format
Action policies are JSON files with the following structure:Fields
| Field | Type | Required | Description |
|---|---|---|---|
default | ”allow” | “deny” | Yes | Default policy for actions not in allow/deny lists |
allow | string[] | No | Action categories to explicitly allow |
deny | string[] | No | Action categories to explicitly deny (takes precedence) |
Action Categories
Actions are grouped into categories for easier policy management:| Category | Actions | Description |
|---|---|---|
navigate | navigate, back, forward, reload, tab_new | Page navigation |
click | click, dblclick, tap | Click interactions |
fill | fill, type, keyboard, inserttext, select, multiselect, check, uncheck, clear, selectall, setvalue | Form input and text entry |
download | download, waitfordownload | File downloads |
upload | upload | File uploads |
eval | evaluate, evalhandle, addscript, addinitscript, addstyle, expose, setcontent | JavaScript evaluation (high risk) |
snapshot | snapshot, screenshot, pdf, diff_snapshot, diff_screenshot, diff_url | Page inspection and diffing |
scroll | scroll, scrollintoview | Scrolling |
wait | wait, waitforurl, waitforloadstate, waitforfunction | Waiting operations |
get | gettext, content, innerhtml, innertext, inputvalue, url, title, getattribute, count, boundingbox, styles, isvisible, isenabled, ischecked, responsebody, getbyrole, getbytext, etc. | Read-only data retrieval |
network | route, unroute, requests | Network interception |
state | state_save, state_load, cookies_set, storage_set, credentials | Browser state manipulation |
interact | hover, focus, drag, press, keydown, keyup, mousemove, mousedown, mouseup, wheel, dispatch | Low-level interactions |
Policy Evaluation
When an action is requested, the policy is evaluated in this order:- Internal actions - Always allowed (launch, close, session management, etc.)
- Explicit deny - If category is in
denylist, action is denied - Confirmation required - If category is in
--confirm-actions, prompt user (if interactive) - Explicit allow - If category is in
allowlist, action is allowed - Default policy - Use
defaultvalue (“allow” or “deny”)
Internal Actions
These actions bypass policy checks and are always allowed:- Browser management:
launch,close,tab_list,tab_switch,tab_close - Session management:
session - Information:
cookies_get,storage_get,state_list,state_show - Debugging:
console,errors,highlight,trace_start,trace_stop - Auth:
auth_save,auth_login,auth_list,auth_delete,auth_show - Confirmation:
confirm,deny
Common Policy Patterns
Read-Only Agent
Allow only inspection, no interaction:Safe Interaction Agent
Allow navigation and form filling, deny dangerous actions:Minimal Permissions
Only essential actions:Development Mode
Allow everything except eval:Action Confirmation
Require explicit user approval for sensitive action categories:Confirmation Flow
When an action requires confirmation:- Agent requests the action
- CLI prompts user with action details
- User approves (
confirm) or denies (deny) - Action proceeds or is rejected
Interactive vs Non-Interactive
- Interactive mode (
--confirm-interactive): Prompts user via CLI - Non-interactive mode: Auto-denies if stdin is not a TTY
Confirmation Categories
Common categories to require confirmation:eval- JavaScript execution (high risk)download- File downloads (data exfiltration risk)upload- File uploads (may leak local files)network- Network interception (can modify responses)state- State manipulation (can steal cookies)
Hot Reloading
Policy files are automatically reloaded every 5 seconds. Update the policy without restarting the browser:Environment Variables
| Variable | Description | Example |
|---|---|---|
AGENT_BROWSER_ACTION_POLICY | Path to action policy JSON file | ./policy.json |
AGENT_BROWSER_CONFIRM_ACTIONS | Comma-separated action categories requiring confirmation | eval,download |
AGENT_BROWSER_CONFIRM_INTERACTIVE | Enable interactive confirmation prompts | true |
Configuration File
Set action policy inagent-browser.json:
Programmatic API
Check and enforce action policies programmatically:Auto-reloading Policy
Best Practices
1. Start with Deny-by-Default
For production agents, use deny-by-default and explicitly allow required actions:2. Always Deny Eval
JavaScript evaluation is high-risk. Deny it unless absolutely necessary:eval also prevents bypassing domain allowlist (see Domain Allowlist).
3. Require Confirmation for Downloads
Prevent data exfiltration by requiring confirmation for downloads:4. Combine with Domain Allowlist
For maximum security, use both action policy and domain allowlist:5. Use Hot Reloading for Testing
During development, use hot reloading to adjust policies without restarting:Troubleshooting
Action denied by policy
Symptom: Action fails with error likeAction 'evaluate' denied by policy
Solution: Add the action’s category to the allow list:
"allow" and only deny specific categories.
Unrecognized action category warning
Symptom: Warning likeunrecognized action category "typo" in policy file
Solution: Fix the typo in your policy file. Valid categories are:
- navigate, click, fill, download, upload, eval, snapshot, scroll, wait, get, network, state, interact
Confirmation prompts in CI/CD
Symptom: Agent hangs waiting for confirmation in CI/CD environment Solution: Don’t use--confirm-interactive in non-interactive environments. Instead, use action policy to deny actions:
Policy file not found
Symptom: Error likeENOENT: no such file or directory
Solution: Ensure the policy file path is correct (relative to current directory):
See Also
- Security Overview - All security features
- Domain Allowlist - Network restriction
- Auth Vault - Credential storage