# How do I keep a workspace and come back to it later?

Give a sandbox a name and let it fall asleep instead of being deleted. Its files – and even running programs – are still there tomorrow, also in a new chat with your assistant.

## Steps

1. **Create a sandbox with a name**, for example `my-project`, and with `on_timeout: pause` (sleep instead of delete).
2. **Work in it** as usual.
3. **Let it sleep.** It falls asleep by itself after its lifetime or after a while without commands; you can also put it to sleep at once.
4. **Come back.** Ask for the same name again: you get the same sandbox, woken up in a few seconds with its files.

**Ask your assistant**

No code: copy this into Claude or ChatGPT with [WBX Sandbox connected](https://sandbox.wbx.cz/docs/connect.md) and change it to fit.

```
Create a WBX sandbox named my-project that falls asleep instead of being deleted. Save a file notes.txt in it with today's date.

(Next week, in a new chat:)
Open my WBX sandbox my-project and show me notes.txt.
```

**Python**

`pip install wbxsandbox`, your key in `WBXSANDBOX_API_KEY`.

```
from wbxsandbox import Sandbox

# the same name returns the same sandbox – also tomorrow, woken up with its files
sb = Sandbox.create(name="my-project", on_timeout="pause", timeout=1800)
sb.run("echo \"$(date): note\" >> /home/user/notes.txt")
print(sb.run("cat /home/user/notes.txt").stdout)
sb.sleep()                          # stops compute billing now; files stay
```

**TypeScript**

`npm install wbxsandbox` (Node.js 20+); save as `.mts` for top-level `await`.

```
import { WBX } from "wbxsandbox";

const wbx = new WBX();
// the same name returns the same sandbox – also tomorrow, woken up with its files
const sandbox = await wbx.sandboxes.create({ name: "my-project", onTimeout: "pause", timeoutSeconds: 1800 });
await sandbox.commands.run(`echo "$(date): note" >> /home/user/notes.txt`);
console.log((await sandbox.commands.run("cat /home/user/notes.txt")).stdout);
await sandbox.sleep();              // stops compute billing now; files stay
```

**curl**

Just `curl` and `jq`; your key in `WBXSANDBOX_API_KEY`.

```
H="Authorization: Bearer $WBXSANDBOX_API_KEY"
SB=$(curl -s -X POST https://sandbox.wbx.cz/v1/sandboxes -H "$H" -d '{"name": "my-project", "on_timeout": "pause", "timeout_s": 1800}' | jq -r .id)
curl -s -X POST https://sandbox.wbx.cz/v1/sandboxes/$SB/exec -H "$H" -d '{"cmd": "date >> /home/user/notes.txt; cat /home/user/notes.txt"}'
curl -s -X POST https://sandbox.wbx.cz/v1/sandboxes/$SB/sleep -H "$H"
```

## How to tell it worked

- Run it again later: `notes.txt` has the earlier line plus a new one.
- In the portal, *Sandboxes* shows `my-project` as *sleeping* between uses.

## If it doesn't work

| What you see | What to do |
| --- | --- |
| You get a new, empty sandbox | The old one was deleted – by `kill`, or because it stayed asleep longer than your plan keeps sandboxes (14 days on Free). Set `keep_days` when you create it. |
| The assistant does not find the sandbox | Say its exact name. Ask it to list your sandboxes if you do not remember the name. |
| Programs did not continue after waking | Usually they do. When the memory cannot be restored, only the files are kept – start the program again. See [Sleep and wake](https://sandbox.wbx.cz/docs/sandboxes/sleep.md). |

## What it costs

While it runs, like any sandbox (the `base` template about US$0.07, €0.06 or 1.6 Kč an hour). While it sleeps it uses no compute; only its disk is billed as storage. [Pricing](https://sandbox.wbx.cz/pricing).

## Next steps

- [Sleep and wake](https://sandbox.wbx.cz/docs/sandboxes/sleep.md): What a sleeping sandbox keeps, and for how long.
- [A workspace that remembers](https://sandbox.wbx.cz/docs/guides/workspace.md): The whole story with an AI assistant.
- [Publish a web app](https://sandbox.wbx.cz/docs/howto/web-app.md): Put what runs in your workspace on a public address.

Source: https://sandbox.wbx.cz/docs/howto/workspace
