Skip to main content
from browser_use_sdk.v3 import AsyncBrowserUse

client = AsyncBrowserUse()

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

result1 = await client.run(
    "Log into example.com with user@test.com",
    session_id=session.id,
    keep_alive=True,
)
result2 = await client.run(
    "Now go to settings and change the timezone",
    session_id=session.id,
)

await client.sessions.stop(session.id)
Use keep_alive: true to keep the session running after a task completes. Without it, the session auto-stops when the task finishes.