How it works
The mode is set when the sandbox is created. Some providers set it with a flag or with an auto-delete time of zero. Each new task starts a new sandbox. That sandbox can start from a sandbox template.
Why it suits untrusted code
Untrusted code is code you do not fully trust, such as code written by a model. When the sandbox is deleted, its files and processes are gone too. A bad run cannot change the files that the next run reads, unless both runs share storage.
What it does not do
Deletion does not stop an attack from inside the sandbox. The isolation type does that. See microVM for one type of isolation.
How state comes back
An ephemeral sandbox keeps no state by default. To keep state, take a snapshot before the sandbox stops. Or write the files to persistent storage. Some providers let the caller take a snapshot from outside the sandbox, just before it ends.
What to check on a provider
- Whether the sandbox is deleted on stop, or after a set time.
- Whether a stopped sandbox still bills its disk.
- How long the provider keeps a snapshot, and whether it expires.