Overview
ThekeepAlive feature allows you to keep sessions alive across disconnects, permitting you to reconnect and continue using the same session.
By default, Browserbase sessions terminate when a developer disconnects. With Keep Alive enabled, the session remains available for reconnection using the same connection URL.
Session keep alive is only available on paid plans.
Why use Keep Alive?
- Survive disconnects: Network issues or client restarts won’t terminate your session
- Reconnect to existing sessions: Continue where you left off without starting fresh
- Reuse sessions for performance: Reconnecting is faster than creating a new session
Creating a Keep Alive Session
SettingkeepAlive to true will keep the session available for later use. You can reconnect to the session using the same connection URL.
- Node.js
- Python
Stopping a Keep Alive Session
Keep alive sessions must be explicitly stopped when you’re done with them. Use the API or SDK to release the session.- Node.js
- Python
We recommend stopping keep alive sessions explicitly when no longer needed.
They will eventually time out, but you will be charged for all browser minutes used.
Keep Alive and Timeouts
Keep alive sessions still respect session timeouts. If you need a session that both survives disconnects and runs for an extended period, configure both options:Session Timeouts
Learn how to extend session duration beyond the default timeout.