Skip to main content

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:
Output:

cookies set

Set a cookie.
ParameterDescription
nameCookie name
valueCookie value
Options:
OptionDescription
—urlURL to set cookie for
—domainCookie domain
—pathCookie path (default: /)
—httpOnlyHttpOnly flag
—secureSecure flag
—sameSiteSameSite attribute: Strict, Lax, None
—expiresExpiration timestamp (Unix epoch)
Examples:

cookies clear

Clear all cookies. Examples:

Local Storage

storage local

Get all localStorage items. Examples:
Output:

storage local (key)

Get specific localStorage item.
ParameterDescription
keyStorage key
Examples:
Output:

storage local set

Set localStorage item.
ParameterDescription
keyStorage key
valueStorage value
Examples:

storage local clear

Clear all localStorage. Examples:

Session Storage

Session storage commands work identically to local storage, but use storage session instead: Examples:

Browser State

state save

Save current browser state (cookies, localStorage, sessionStorage) to a file.
ParameterDescription
pathFile path to save state
Examples:
Output:

state load

Load browser state from a file.
ParameterDescription
pathFile path to load state from
Examples:
Output:

state list

List all saved state files. Examples:
Output:

state show

Show summary of a state file.
ParameterDescription
filenameState file name
Examples:
Output:

state clear

Clear saved state files.
ParameterDescription
nameOptional: Session name to clear
Options:
OptionDescription
—all, -aClear all saved states
Examples:

state clean

Delete old state files.
OptionDescription
—older-thanDelete states older than N days
Examples:

state rename

Rename a state file.
ParameterDescription
old-nameCurrent state file name
new-nameNew state file name
Examples:

Workflow Examples

Skip Login Flow

Session Management

Testing with Different States

Manage User Preferences

Persistent Sessions

Use --session-name to automatically save and restore state:

State Encryption

Encrypt saved state files with AES-256-GCM:

Environment Variables

VariableDescription
AGENT_BROWSER_SESSION_NAMEAuto-save/load state with this name
AGENT_BROWSER_ENCRYPTION_KEY64-char hex key for AES-256-GCM encryption
AGENT_BROWSER_STATE_EXPIRE_DAYSAuto-delete states older than N days (default: 30)