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

# Control cost

> Idle sleep is automatic; archive when you're done for days. Usually the right move is nothing.

You mostly don't have to: **a sandbox idle by every measure (no work, no live
connections, no API calls for \~60 s) is slept automatically and costs nothing;
the next call wakes it transparently.** A running server or background job
keeps it awake indefinitely. Beyond that:

```python theme={null}
sb.sleep()        # nap right now; next call wakes it (ms). Not durable.
sb.archive()      # put it away: memory+disk to object storage, host freed,
                  # billing stopped. Survives node loss. Seconds.
sb.unarchive()    # bring it back (seconds). info.state reads "archived" while parked.
```

Rule of thumb: do nothing for idle gaps; `archive()` when you're done for days.
(`stop()`/`start()` are the old names for archive/unarchive and keep working.)

For the full menu of rest states with measured costs — pause/resume, sleep,
`snapshot(leave_paused=True)`, archive, reboot — see [How it thinks](/concepts#rest-states).

## Sharp edges

Paused and slept sandboxes keep RAM resident and **hold a slot against the
20-sandbox cap**; archived ones don't. `archive()` composes from any rest
state. Data not in a snapshot, an archived sandbox, or an export is gone at
delete.
