Skip to main content

Purpose

Ends a Browserbase session and cleans up resources. Called when the user leaves the page or the session is no longer needed.

Architecture

Cleanup Steps

  1. Cancel Navigation Task - Stop any in-progress Playwright navigation
  2. Release Session - Tell Browserbase to release the session
  3. Clear Cache - Remove from _ACTIVE_SESSION_BY_CLIENT

Browserbase Release

POST /v1/sessions/{session_id}
{
    "projectId": project_id,
    "status": "REQUEST_RELEASE"
}

Code Location

src/website/browser_session/routes.py
# Lines 324-367: end_browser_session()

Rate Limiting

  • 10 requests per minute per IP address