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

# Sandbox Lifecycle

> Understand how your chat sandbox persists between messages — your installed packages, files, and running processes stay alive across conversations.

## Overview

Every chat thread runs in its own isolated sandbox. When you send a message, the agent has access to a full Linux environment where it can install packages, write files, run code, and execute commands. This sandbox persists between messages within the same thread.

<Note>
  Your sandbox automatically pauses when idle and resumes instantly when you return — no setup required.
</Note>

## How persistence works

When you send a message in a chat thread, the agent's sandbox is in one of three states:

<AccordionGroup>
  <Accordion title="Active — sandbox is running">
    The sandbox is live and ready. Your previous messages' context (installed packages, files, running processes) are all available. This is the fastest state — the agent can start working immediately.

    **When this happens:** You're actively chatting or recently sent a message.
  </Accordion>

  <Accordion title="Paused — sandbox is saved">
    After 30 minutes of inactivity, the sandbox automatically pauses. Everything is saved — files, packages, memory, running processes. Nothing is lost.

    **When this happens:** You step away from a thread for more than 30 minutes.
  </Accordion>

  <Accordion title="Fresh — new sandbox">
    If the saved sandbox is no longer available, a new one is created. Your conversation history is preserved, but installed packages and files from previous messages need to be re-created.

    **When this happens:** Very old threads or after extended periods of inactivity.
  </Accordion>
</AccordionGroup>

## What this means for you

### Packages persist between messages

If you ask the agent to install `pandas` in your first message, it's still available in your second, third, and hundredth message — as long as you're in the same thread.

```
You: Install pandas and matplotlib
Agent: Done! Both packages are installed.

You: Now create a chart of Apple's stock price
Agent: [uses pandas and matplotlib without reinstalling]
```

### Files persist between messages

Files created by the agent stay on disk. You can reference them in later messages:

```
You: Download the sales data and save it as sales.csv
Agent: Saved to sales.csv

You: Now analyze sales.csv and create a summary report
Agent: [reads the previously saved file]
```

### Resuming is fast

When you return to a paused sandbox, it resumes in about one second. You won't notice any delay — the agent picks up right where you left off.

## Thread isolation

Each chat thread has its own sandbox. Work done in one thread doesn't affect another:

* **Thread A** installs `pandas` → only Thread A has `pandas`
* **Thread B** is completely independent with its own packages and files
* Deleting a thread cleans up its sandbox

<Tip>
  If you need the same environment across multiple tasks, create an **agent** from your configured thread. The agent captures the full sandbox environment and reuses it for every run.
</Tip>

## When is a fresh sandbox created?

A new sandbox is created when:

* You start a **new chat thread**
* The previous sandbox is no longer available (rare, usually after extended inactivity)

**Agent runs** are different — each run creates a sandbox from the agent's saved environment snapshot (see [Agent Runtime Environment](/pro/agent-runtime-environment)). This means the sandbox comes pre-loaded with all the packages and configuration from when the agent was created or last updated, rather than starting from a blank slate.

In all cases, the agent has access to your conversation history, so it can understand context from previous messages even in a fresh sandbox.

## Best practices

<CardGroup cols={2}>
  <Card title="Keep related work in one thread" icon="message-lines">
    Packages and files persist within a thread. Keep related tasks together to avoid re-installing.
  </Card>

  <Card title="Save reusable setups as agents" icon="rocket">
    If you spend time configuring an environment, save it as an agent so you don't repeat the setup.
  </Card>

  <Card title="Use workspaces for organization" icon="folder">
    Group related threads in a workspace. Each thread still has its own sandbox, but workspaces help you stay organized.
  </Card>

  <Card title="Reference files by path" icon="file">
    The agent remembers file paths between messages. Reference them directly for efficient follow-ups.
  </Card>
</CardGroup>
