> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rustybrowser.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Browser Lifecycle

> How browsers are created, used, and closed

## Overview

A browser in Rusty Browser is an isolated browser instance managed by `rusty-server` and a browser agent. You create it, issue commands, and delete it when your workflow is complete.

## Lifecycle

```text theme={null}
PUT /browsers/        -> browser created
  POST /:id/navigate/
  POST /:id/click/
  POST /:id/instruct/
  ...
DELETE /browsers/:id/ -> browser closed and resources released
```

## Resource Usage

Each active browser uses compute, memory, browser process capacity, and agent slots on your infrastructure. Idle browsers stay alive until you close them, so cleanup is important in every deployment.

## Best Practices

* **Always delete browsers** when your task is complete
* Use `defer client.DeleteBrowser(...)` in Go to guarantee cleanup
* Create browsers only when a workflow is ready to use them
* Use `DELETE /browsers/` or `rusty-cli browser close-all` for test teardown and recovery cleanup
* Use session logs to debug long-running instructions and failed browser actions

## Isolation

Each browser runs in a completely isolated environment:

* Fresh state on every creation, with no cookies, cache, or history carried over
* No shared state between browsers
* Failures in one browser do not affect others
