from browser_use_sdk.v3 import AsyncBrowserUse
client = AsyncBrowserUse()
# 1. Create a persistent session
session = await client.sessions.create(keep_alive=True)
print(f"Live view: {session.live_url}")
# 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)
# 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)