Overview
State management commands allow you to control cookies, localStorage, sessionStorage, and save/load browser state.Cookies
cookies
Get all cookies for the current page. Examples:cookies set
Set a cookie.| Parameter | Description |
|---|---|
name | Cookie name |
value | Cookie value |
| Option | Description |
|---|---|
—url | URL to set cookie for |
—domain | Cookie domain |
—path | Cookie path (default: /) |
—httpOnly | HttpOnly flag |
—secure | Secure flag |
—sameSite | SameSite attribute: Strict, Lax, None |
—expires | Expiration timestamp (Unix epoch) |
cookies clear
Clear all cookies. Examples:Local Storage
storage local
Get all localStorage items. Examples:storage local (key)
Get specific localStorage item.| Parameter | Description |
|---|---|
key | Storage key |
storage local set
Set localStorage item.| Parameter | Description |
|---|---|
key | Storage key |
value | Storage value |
storage local clear
Clear all localStorage. Examples:Session Storage
Session storage commands work identically to local storage, but usestorage session instead:
Examples:
Browser State
state save
Save current browser state (cookies, localStorage, sessionStorage) to a file.| Parameter | Description |
|---|---|
path | File path to save state |
state load
Load browser state from a file.| Parameter | Description |
|---|---|
path | File path to load state from |
state list
List all saved state files. Examples:state show
Show summary of a state file.| Parameter | Description |
|---|---|
filename | State file name |
state clear
Clear saved state files.| Parameter | Description |
|---|---|
name | Optional: Session name to clear |
| Option | Description |
|---|---|
—all, -a | Clear all saved states |
state clean
Delete old state files.| Option | Description |
|---|---|
—older-than | Delete states older than N days |
state rename
Rename a state file.| Parameter | Description |
|---|---|
old-name | Current state file name |
new-name | New state file name |
Workflow Examples
Skip Login Flow
Session Management
Testing with Different States
Manage User Preferences
Cookie-Based Auth
Persistent Sessions
Use--session-name to automatically save and restore state:
State Encryption
Encrypt saved state files with AES-256-GCM:Environment Variables
| Variable | Description |
|---|---|
AGENT_BROWSER_SESSION_NAME | Auto-save/load state with this name |
AGENT_BROWSER_ENCRYPTION_KEY | 64-char hex key for AES-256-GCM encryption |
AGENT_BROWSER_STATE_EXPIRE_DAYS | Auto-delete states older than N days (default: 30) |