Skip to main content
Use a browser profile to skip login flows — the agent starts already authenticated. Add secrets as a fallback for sites that expire cookies quickly. When to use this approach:
  • You have accounts you log into regularly and want the agent to use them
  • You need the agent to interact with private dashboards, inboxes, or settings pages
  • You want to avoid passing raw credentials when possible
from browser_use_sdk import AsyncBrowserUse

client = AsyncBrowserUse()

# 1. Create session with profile
session = await client.sessions.create(profile_id="your-profile-id")

# 2. Run authenticated task
result = await client.run(
    "Go to my GitHub notifications and summarize the unread ones",
    session_id=session.id,
    secrets={"github.com": "backup-token-if-needed"},
    allowed_domains=["github.com"],
)
print(result.output)

# 3. Clean up
await client.sessions.stop(session.id)
Always stop the session when you’re done — profile state (cookies, localStorage) is only saved when the session ends.
Profiles preserve cookies, localStorage, and saved passwords. Secrets are domain-scoped — the agent only uses them on matching domains. Combine both for maximum reliability.
See Authentication & 2FA for setup instructions including profile sync and 1Password integration.