import { CodeBlock } from "@/components/code-block"; export default function Sessions() { return (

Sessions

Run multiple isolated browser instances:

default # agent1 # Show current session agent-browser session`} />

Session isolation

Each session has its own:

  • Browser instance
  • Cookies and storage
  • Navigation history
  • Authentication state

Authenticated sessions

Use --headers to set HTTP headers for a specific origin:

"}' # Requests to api.example.com include the auth header agent-browser snapshot -i --json agent-browser click @e2 # Navigate to another domain - headers NOT sent agent-browser open other-site.com`} />

Useful for:

  • Skipping login flows - Authenticate via headers
  • Switching users - Different auth tokens per session
  • API testing - Access protected endpoints
  • Security - Headers scoped to origin, not leaked

Multiple origins

Global headers

For headers on all domains:

); }