A browser session lifecycle an agent can reason about
Create, inspect, connect and close Cloudflare Browser Run sessions without confusing access links with persistent browser state.
Pause automation, guide a private live-view sign-in and verify the returned account before continuing an authorized task.
A good sign-in handoff tells the operator which site, account and task need authentication. It does not ask the person to make an unexplained browser window work. Before minting a link, navigate to the intended public site and read the page so the agent can describe the current step accurately. If the task instead needs an app connection managed by Lupin's connection product, use that flow rather than implying that a browser login creates a reusable OAuth connection. A browser session and a managed app connection have different lifecycles and permissions.
The workspace needs human verification, appropriate browser permissions, billing eligibility and provider capacity. An active session also has a finite runtime policy; the live-view URL does not extend it. Plan the handoff early enough that the operator can finish before the session's remaining budget expires. Lupin requests a maximum ten-minute inactivity timeout and can shorten it to the lease. Do not promise that a login page will remain available indefinitely. If the session ended while waiting, create a new authorized session and explain that its browser state starts fresh.
Request connect for the known session identifier and deliver live_view_url only through a trusted interface. The five-minute access deadline is for starting the connection. Avoid writing either that URL or connect_url into a shared task transcript because both carry access authority. Pause agent actions before the operator begins. Competing automation can move focus, navigate away or submit a field while the person is completing MFA. A visible indication that the operator has control is useful, along with a clear way to return control when the sign-in step is finished.
const access = await lupin.browsers.connect(sessionId);
// Display access.live_view_url privately in the operator handoff UI.
// On return, refresh tabs and read the intended account page.After the operator hands control back, list tabs and read the relevant page again. OAuth flows can open or close popup windows, redirect to another domain or leave a consent screen incomplete. Confirm the destination account and the task's required capability using visible evidence. Do not treat the operator's connection alone as proof that authentication succeeded. If consent requests broader scopes than the task needs, the human should decide whether to continue. An account mismatch is a reason to stop dependent work, since a technically successful action in the wrong account is still a failed task.
Reviewed against the current Lupin route, provider adapter and shared input contracts, plus the linked official references. Examples were not run against live services.
Prepared with AI assistance by Lupin editorial. How we research and maintain these guides.