Learn how to manage session termination and inspect completed sessions
While Browserbase automatically handles session termination when you disconnect, understanding how sessions end helps you debug failed runs, manage long-running sessions, optimize resource usage, and investigate timeouts or errors.
Automatic Timeout
Sessions have a default timeout configured at the project level, which can be customized when creating a session. For longer-running tasks, enable keep alive.
Manual Termination
You can end sessions explicitly by closing the browser programmatically (browser.close() or driver.quit()), using the Sessions API, or releasing keep-alive sessions when no longer needed.
Unhandled Errors
Unhandled errors in your automation code can cause your script to disconnect from the browser, ending the session prematurely. Common scenarios include network interruptions, uncaught exceptions, or exceeded resource limits.To prevent premature termination, make sure to implement proper error handling and cleanup in your code.
Configure timeouts at two levels:Project Level
Set the default timeout for all sessions in your project settings. This acts as the fallback when no session-specific timeout is set.Session Level
Override the project timeout for specific sessions when creating them. This gives you fine-grained control over individual session durations.
Track and analyze your browser session usage through multiple interfaces:Dashboard
Your central hub at browserbase.com/overview shows total browser minutes, active sessions, usage trends, and billing information.Sessions List
Browse your session history at browserbase.com/sessions to view duration, status, and resource consumption for individual sessions.For programmatic access to these metrics, see the Measuring Usage Guide.