Skip to main content
A session is the container the agent works in: one cloud browser and one or more tasks, sharing the same browser state. When you call client.run(), the SDK creates a session and runs your first task inside it — you don’t have to manage sessions yourself unless you want to.
Create a session explicitly when you want to run several tasks in the same browser, embed a live view before the first task, or manage the session’s lifecycle yourself.

Session vs. task vs. browser session

These three are easy to confuse: A session holds tasks and wraps a browser. If you want the agent to decide the clicks, you’re in session/task territory. If you want to drive Chrome yourself, use a browser session directly.

Create a session and run tasks in it

Pass session_id to client.run() to run each task in the same session. The browser state carries over between tasks — see Follow-up tasks.
sessions.create() returns a live_url you can embed to watch tasks execute — see Live preview.
Sessions time out after 15 minutes of inactivity by default. The maximum session duration is 4 hours.

Lifecycle

A session is active while its browser is running and stopped once it ends — whether you stop it, it times out, or it hits the 4-hour cap. Stopping a session stops every task still running inside it.

Manage sessions

Share a session

Create a public share link to let anyone view a session’s replay without an API key.
For projects on zero-data-retention, client.sessions.purge(session_id) immediately deletes all data for a session.

Next