# Tabs and lifecycle (/es/docs/browser/tabs)

How turno-browser keeps an identity's Chrome from piling up pages, and when Chrome itself closes and opens again.

A browser an agent leaves open for hours should not eat the machine. This page lists what closes, when, and how to change each limit.

## Lifecycle [#lifecycle]

| When | What happens |
|---|---|
| 15 minutes without a tool call | Chrome closes; it opens again with the same profile on the next call (`TURNO_BROWSER_IDLE` changes it, `"0"` keeps it open) |
| The server sits idle for `idle` | mcpd stops the server, sooner under memory pressure |
| mcpd stops the server | it closes the server's stdin and waits 5 seconds before SIGTERM, so Chrome closes and writes its profile on its own |
| A server was killed and left Chrome open | that Chrome is closed the next time the identity starts |
| The background server gets no request for 15 minutes | it closes Chrome and exits (`--background-idle` or `TURNO_BROWSER_BACKGROUND_IDLE` changes it, `"0"` keeps it running) |

## Tabs [#tabs]

While the agent works, turno keeps the identity's Chrome from piling up pages:

| What | Default | Why |
|---|---|---|
| At most `max` pages open | 8 | past it, the least recently used page closes (never the agent's current tab) |
| Popups that open while no tool call runs | closed | pop-unders and ads; a window the agent's own click opened stays |
| A page unused for `park` | 5 minutes | it goes to about:blank and stops running; it loads its page again when the agent uses it |
| A page unused for `close` | 15 minutes | it closes |

Change them in `identity.json` (format 2), with `turno-browser set`, or with the server's flags,
which win over the file:

```json
{
  "version": 2,
  "tabs": { "max": 4, "popups": "keep", "park": "2m", "close": "0" }
}
```

```sh
turno-browser set school --tabs-max 4 --tabs-popups keep --tabs-park 2m --tabs-close 0
turno-browser-mcp --identity school --max-tabs 4 --popups keep --park-after 2m --close-after 0
```

An empty value removes one key (`--tabs-park ""`) and `--no-tabs` the whole group; `--dry-run
--json` shows the file `set` would write without writing it.

`"0"` turns a stage off and `max: 0` removes the cap. What turno closed or parked is listed at
the end of the next tool result. In a headless Chrome without the live view, background tabs are
throttled by default: Chrome slows them down, and turno brings the agent's tab to the front before
each call. With a window or the live view on, they run at full speed, as Playwright launches
Chrome, because a covered headed window stops rendering and the live view needs frames.
`"backgroundThrottling": true` or `false` (`turno-browser set school --background-throttling
false`, or the server's `--background-throttling`) decides it for good.

## Low-resource mode [#low-resource-mode]

On a laptop with little memory, every Chrome an identity opens, and every tab in it, adds up
until the system starts swapping or restarts. By default (`"resources": "auto"`, or no key) the
preset below turns on by itself when the system reports memory pressure as Chrome starts; it is
read again at every launch. `"low"` keeps it on and `"normal"` keeps it off:

```sh
turno-browser set school --resources low
turno-browser-mcp --identity school --resources low   # the flag wins over identity.json
turno-browser set school --resources normal          # never, even under memory pressure
```

`turno-browser show school` says which applies and why, for example `resources: low (auto: memory
pressure)`.

| What | Default | With `"resources": "low"` |
|---|---|---|
| Pages open at once (`tabs.max`) | 8 | 2 |
| An unused page is parked (`tabs.park`) | after 5 minutes | after 2 minutes |
| Chrome closes without a tool call | after 15 minutes | after 5 minutes |
| The background server exits without a request | after 15 minutes | after 5 minutes |
| Chrome's back/forward cache | on | off, so a parked page frees its memory at once |
| A note in tool results while memory is low | no | yes |

A key set on its own still wins over the preset: `--tabs-max 3` with `--resources low` keeps 3
tabs, and `TURNO_BROWSER_IDLE`, `--idle-timeout`, `--background-idle` and
`TURNO_BROWSER_BACKGROUND_IDLE` keep the limits you set. `--resources normal` (or an empty
value, which removes the key, back to `auto`) sets the limits back to the defaults.

While the system reports memory pressure (the same reading mcpd uses to stop idle servers
sooner: the kernel's level on macOS, pressure stall information on Linux), the preset adds a
short line under `### Memory` at the end of a tool result (`turno.memory` in JSON) when the level
rises, and again every 5 minutes while it stays up, so the agent can finish and close tabs. It
only warns: nothing closes a session that is working. `turno-browser doctor` shows the pressure
too, on every machine.

### What it saves [#what-it-saves]

Measured with Chrome 157 on a 16 GB Mac: one identity's Chrome, with five local pages a session
might open (a news page with images and a cross-site ad frame, a dashboard with a large table,
a mail page with three cross-site frames, a canvas animation, a docs page). Memory is the
footprint of Chrome's whole process group (what macOS counts against the machine, compressed
memory included), the middle of two or three runs:

| Session | Chrome's memory |
|---|---|
| Defaults, 5 tabs open | about 1,040 MB |
| Defaults, 5 tabs, 3 of them parked | about 1,000 MB: the back/forward cache keeps parked pages alive |
| Defaults, 5 tabs, 3 parked, back/forward cache off | about 800 MB |
| Low, while the agent works (2 tabs) | about 445 MB |
| Low, 2 minutes later (the other tab parked) | about 315 MB |
| Low, 5 minutes without a call | Chrome closed: 0 MB until the next call |

What was measured and left out, because it saved little or broke something:

- Background throttling (`backgroundThrottling`) saved about 120 MB with 2 tabs, but a
  minimized or covered window then stops rendering the agent's own tab: its scripts stop and
  the live view gets no frames. It is on by default only in a headless Chrome without the live
  view.
- `--enable-low-end-device-mode` and turning off Chrome's spare renderer each saved 10 to 20 MB
  on top of the preset, inside the run-to-run spread.
- `--renderer-process-limit=2` saved under 5 % and `--process-per-site` about 8 % with 5 tabs
  (it runs every tab of a site in one process, so one busy tab slows the others); with 2 tabs
  there is little left to share. Disabling the optimization guide, component updates and
  similar services saved nothing: Playwright's launch already turns Chrome's background
  networking off.
- `--disable-gpu` used about 300 MB more; turning site isolation off saved about 110 MB but
  weakens the isolation between sites, so it is not an option.