[Launch options](https://cdpfleet.com/docs/options)

# `keep_alive`

Keep the session when your client disconnects (dedicated threads only).

**Use it for:** Agents and step-by-step workflows that disconnect between steps, and code that may lose its connection, without losing the logged-in browser.

**Browsers:** [Google Chrome](https://cdpfleet.com/docs/browsers/chrome#opt-keep_alive), [Microsoft Edge](https://cdpfleet.com/docs/browsers/edge#opt-keep_alive), [Brave](https://cdpfleet.com/docs/browsers/brave#opt-keep_alive), [Opera](https://cdpfleet.com/docs/browsers/opera#opt-keep_alive), [Naver Whale](https://cdpfleet.com/docs/browsers/whale#opt-keep_alive), [Yandex Browser](https://cdpfleet.com/docs/browsers/yandex#opt-keep_alive), [Chromium](https://cdpfleet.com/docs/browsers/chromium#opt-keep_alive), [Patchright](https://cdpfleet.com/docs/browsers/patchright#opt-keep_alive), [Camoufox](https://cdpfleet.com/docs/browsers/camoufox#opt-keep_alive), [Firefox](https://cdpfleet.com/docs/browsers/firefox#opt-keep_alive), [WebKit](https://cdpfleet.com/docs/browsers/webkit#opt-keep_alive).

## Details

-   **Type:** `boolean`
-   **Default:** false
-   **Example:** `{"keep_alive":true}`

A disconnect no longer ends the session: reconnect to the same `wsUrl` or `cdpUrl` until `inactivity_timeout` runs out. Over `wsUrl`: on the first connect create your context and page as usual (`browser.newContext()`, `newPage()`); after a reconnect, `browser.contexts()` lists the contexts you created, with their pages, cookies and page state intact. Over `cdpUrl` (`connectOverCDP`): work in the browser's default context, `browser.contexts()[0]` — contexts created with `newContext()` over CDP close when the client disconnects.

Not on Rebrowser. Dedicated threads only (`403 keep_alive_requires_dedicated` on shared plans). The session is billed while it's alive, attached or not — and `browser.close()` only disconnects: the session ends after `inactivity_timeout` without a client, or at once with `DELETE /v1/me/threads/{sessionId}` (or End in the dashboard). Set `inactivity_timeout` to how long it may wait for you.

## Used in

-   [Case 78: keep\_alive: an agent run that survives its client going away](https://cdpfleet.com/docs/cases/keep-alive-reconnect)
-   [Chrome you can disconnect from and come back to](https://cdpfleet.com/docs/examples#chrome-keep-alive)
-   [Microsoft Edge over CDP that survives a disconnect](https://cdpfleet.com/docs/examples#edge-keep-alive)
-   [Headful Opera over CDP that survives a disconnect](https://cdpfleet.com/docs/examples#opera-keep-alive)

All options: [launch options](https://cdpfleet.com/docs/options).

---
Source: https://cdpfleet.com/docs/options/keep_alive · Markdown: https://cdpfleet.com/docs/options/keep_alive.md · All docs for AI tools: https://cdpfleet.com/llms.txt
