Skip to main content
When you pass a session_id, the session automatically stays alive between tasks. Each task runs a new agent that reuses the same browser — the agents don’t share context, but the browser state (page, cookies, tabs) carries over.
from browser_use_sdk.v3 import AsyncBrowserUse

client = AsyncBrowserUse()

# Create a session, then run tasks inside it
session = await client.sessions.create()

result1 = await client.run(
    "Go to amazon.com, search for laptops, and open the first result",
    session_id=session.id,
)
result2 = await client.run(
    "Extract the customer reviews",
    session_id=session.id,
)

await client.sessions.stop(session.id)
sessions.create() returns a live_url you can embed to watch each task execute — see Live preview. To stream messages as each task runs, use client.run() with for await — see Live messages.
Sessions time out after 15 minutes of inactivity by default. The maximum session duration is 4 hours.