Skip to main content

Use cases

  • Human enters payment info or approves a transaction, agent handles the rest
  • Human navigates a complex auth flow, then hands back to agent
  • Human reviews what the agent did before the agent continues

Flow

  1. Create a session with keep_alive=True so it stays alive between tasks
  2. Run an agent task — poll sessions.get() for live_url (~3-5 seconds)
  3. Human interacts with the live browser
  4. Send a new follow-up task
import asyncio
from browser_use_sdk.v3 import AsyncBrowserUse

client = AsyncBrowserUse()

# 1. Create a persistent session
session = await client.sessions.create(keep_alive=True)

# 2. Agent does the first part
result = await client.run(
    "Go to Google Flights and search for flights from NYC to London",
    session_id=session.id,
)
print(result.output)

# Get the live URL (available while session is alive with keep_alive)
s = await client.sessions.get(session.id)
while not s.live_url:
    await asyncio.sleep(1)
    s = await client.sessions.get(session.id)
print(f"Live view: {s.live_url}")

# 3. Human opens live_url and picks a flight
input("Press Enter after you've selected a flight in the live view...")

# 4. Agent continues where the human left off
result = await client.run(
    "Get the details of the selected flight — airline, price, departure and arrival times",
    session_id=session.id,
)
print(result.output)

# Clean up
await client.sessions.stop(session.id)