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

# Keep work between sessions

> Persist files, installed packages, and workspace changes across sessions by stopping a Celesto computer and restarting it later by ID or name.

You can keep work inside a Celesto computer and come back to it later. Stop the computer when you are done for now, save its ID or name, then start the same computer again to continue from the same files and tools. This saved work is called state.

Celesto keeps both the computer root disk and workspace state across stop and start. For large workspace files, see [Petabyte-scale storage for AI agent sandboxes](/celesto-sdk/features/petabyte-storage).

## When to keep state

Keep state when you want to:

* Continue an agent task after a break.
* Reuse installed packages instead of installing them again.
* Keep generated files, source code, or build output.
* Restart a preview app from the same workspace.
* Hand the same computer to another job or agent.

<Warning>
  Delete a computer when you no longer need its saved work. Deleting a computer removes its files, installed packages, and resources.
</Warning>

## Stop and start the same computer

The simplest way to keep state is to stop a computer instead of deleting it. A stopped computer keeps its workspace, which means the files and folders inside the computer.

The example below creates a file, stops the computer, starts it again, and checks that the file is still there.

<CodeGroup>
  ```python Python theme={null}
  from celesto import Computer


  computer = Computer(template_id="coding-agent")

  computer.run("echo ready > status.txt")
  computer.stop()

  computer.start()
  result = computer.run("cat status.txt")
  print(result["stdout"].strip())

  computer.delete()
  ```

  ```ts TypeScript theme={null}
  import { Computer } from "@celestoai/sdk";

  const computer = await Computer.create({ templateId: "coding-agent" });

  await computer.run("echo ready > status.txt");
  await computer.stop();

  await computer.start();
  const result = await computer.run("cat status.txt");
  console.log(result.stdout.trim());

  await computer.delete();
  ```

  ```bash CLI theme={null}
  celesto computer create --template coding-agent

  celesto computer run einstein "echo ready > status.txt"
  celesto computer stop einstein

  celesto computer start einstein
  celesto computer run einstein "cat status.txt"
  # ready

  celesto computer delete einstein
  ```
</CodeGroup>

<Check>
  The command prints `ready` after the computer starts again, which means the workspace was saved.
</Check>

## Save the computer ID or name

Use the same computer when you want the same state.

* In SDK code, save `computer.id`.
* In the CLI, use the computer name shown by `celesto computer create`.

<Tip>
  Store the computer ID or name in the job record, database row, or task metadata that needs to resume the work later.
</Tip>

## Choose stop or delete

Stopping and deleting both end a work session, but they have different outcomes.

| Action | What happens                                    | Use it when                               |
| ------ | ----------------------------------------------- | ----------------------------------------- |
| Stop   | The computer turns off and keeps its workspace. | You plan to continue the same work later. |
| Start  | The stopped computer turns on again.            | You are ready to continue the saved work. |
| Delete | The computer and its workspace are removed.     | You are finished with the saved work.     |

## Resume agent sessions

If you use Celesto with OpenAI `SandboxAgent`, you can also save an agent session and resume it later. A session is the saved connection between the agent and its sandbox computer.

Use this when the same agent workflow needs to continue with the same files and identity. See [Sandbox an OpenAI agent using Celesto or SmolVM](/celesto-sdk/openai-agents#resume-a-session-later) for the session-specific code.

## Troubleshooting

If a saved file is missing, check these first:

* Use the same computer ID or name that created the file.
* Start the computer before running commands against it.
* Confirm that the computer was stopped, not deleted.

```bash CLI theme={null}
celesto computer list
celesto computer run einstein "ls"
```
