skills/cloud/references/sessions.md
Sessions are stateful browser environments. Each has one browser, runs agents sequentially.
Most tasks auto-create a session:
result = await client.run("Find top HN post") # Session auto-created
For multi-step workflows or custom config:
session = await client.sessions.create(
profile_id="uuid", # Persistent profile
proxy_country_code="us", # Residential proxy
start_url="https://example.com",
)
# Run multiple tasks in same session
await client.run("First task", session_id=session.id)
await client.run("Follow-up task", session_id=session.id)
# Get live URL for monitoring
session_info = await client.sessions.get(session.id)
print(session_info.live_url) # Watch agent in real-time
await client.sessions.stop(session.id)
Every session has a liveUrl for real-time monitoring. Create public share links:
share = await client.sessions.create_share(session.id)
print(share.share_url) # Anyone with link can view
Profiles persist browser state (cookies, localStorage, passwords) across sessions.
# Create
profile = await client.profiles.create(name="my-profile")
# List
profiles = await client.profiles.list()
# Update
await client.profiles.update(profile.id, name="new-name")
# Delete
await client.profiles.delete(profile.id)
Important:
sessions.stop()Upload local browser cookies to cloud profiles:
export BROWSER_USE_API_KEY=your_key
curl -fsSL https://browser-use.com/profile.sh | sh
Opens a browser where you log into sites. Returns a profile_id to use in tasks.
Log in locally, sync cookies to cloud:
curl -fsSL https://browser-use.com/profile.sh | sh
Pass credentials as key-value pairs, scoped to domains:
result = await client.run(
task="Login and check dashboard",
secrets={
"username": "my-user",
"password": "my-pass",
},
allowed_domains=["*.example.com"],
)
Supports wildcards and multiple domains for OAuth/SSO flows.
Use profile for cookies (skip login flow) with secrets as fallback:
session = await client.sessions.create(profile_id="uuid")
await client.run(
task="Check dashboard",
session_id=session.id,
secrets={"password": "backup-pass"},
)
await client.sessions.stop(session.id) # Save profile state
Auto-fill passwords and TOTP/2FA codes from 1Password vault:
op_vault_id param in tasksresult = await client.run(
task="Login to GitHub",
op_vault_id="vault-uuid",
allowed_domains=["*.github.com"],
)
Credentials never appear in logs — filled programmatically by 1Password.
Anti-bot detection requires consistent fingerprint + IP + cookies:
liveUrlsession = await client.sessions.create(
profile_id="social-profile-uuid",
proxy_country_code="us", # Always same country
)
await client.run("Post update to Twitter", session_id=session.id)
await client.sessions.stop(session.id)