# Sandboxes (/docs/en/sandboxes)



Daytona provides **full composable computers** — **sandboxes** — for AI agents. Sandboxes are isolated runtime environments you can manage programmatically to run code. Each sandbox runs in isolation, giving it a dedicated kernel, filesystem, network stack, and allocated vCPU, RAM, and disk. Agents and developers get access to a full composable computer where they can install packages, run servers, compile code, and manage processes.

Sandboxes run as **Linux containers** by default. Daytona also provides [VM sandboxes](#vm-sandboxes) with a dedicated **Linux VM** or **Windows** operating system, and [GPU sandboxes](#gpu-sandboxes) with **NVIDIA GPU** acceleration for model inference, fine-tuning, and CUDA-accelerated compute.

<DocLinkCardGrid>
  <DocLinkCard title="Container" href="#create-sandboxes" icon="package" description="Default Linux container runtime for running processes and executing code." features="['<90ms', 'Dynamic builds', 'Docker images']" />

  <DocLinkCard title="Linux VM" href="#vm-sandboxes" icon="vm" description="Linux OS runtime in a virtual machine for running Linux-specific tools and workflows." features="['Fork', 'Pause/resume', 'Memory snapshots']" />

  <DocLinkCard title="Windows" href="#vm-sandboxes" icon="vm" description="Windows OS runtime in a virtual machine for running Windows applications and tooling." features="['Fork', 'Pause/resume', 'Memory snapshots']" />

  <DocLinkCard title="GPU" href="#gpu-sandboxes" icon="gpu" description="NVIDIA GPU runtime for model inference, fine-tuning, and CUDA-accelerated compute." features="['H100/H200', 'RTX', 'Ephemeral']" />
</DocLinkCardGrid>

## Create sandboxes [#create-sandboxes]

Create a sandbox.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona

    daytona = Daytona()
    sandbox = daytona.create()
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()
    const sandbox = await daytona.create()
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new
    sandbox = daytona.create
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    )

    func main() {
    	client, _ := daytona.NewClient()
    	ctx := context.Background()
    	_, _ = client.Create(ctx, nil)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                Sandbox sandbox = daytona.create();
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona create [flags]
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{}'
    ```
  </TabItem>
</Tabs>

### Snapshots [#snapshots]

Create a sandbox from a [default snapshot](/docs/en/snapshots#default-snapshots).

| **Snapshot**            | **vCPU** | **Memory** | **Storage** | **GPU** | **Sandbox Class** |
| ----------------------- | -------- | ---------- | ----------- | ------- | ----------------- |
| **`daytona-small`**     | 1        | 1GiB       | 3GiB        |         | Container         |
| **`daytona-medium`**    | 2        | 4GiB       | 8GiB        |         | Container         |
| **`daytona-large`**     | 4        | 8GiB       | 10GiB       |         | Container         |
| **`daytona-gpu`**       | 1        | 1GiB       | 1GiB        | 1       | GPU               |
| **`daytona-vm-small`**  | 1        | 1GiB       | 3GiB        |         | Linux VM          |
| **`daytona-vm-medium`** | 2        | 4GiB       | 8GiB        |         | Linux VM          |
| **`daytona-vm-large`**  | 4        | 8GiB       | 10GiB       |         | Linux VM          |
| **`windows-small`**     | 1        | 4GiB       | 30GiB       |         | Windows           |
| **`windows-medium`**    | 2        | 8GiB       | 50GiB       |         | Windows           |
| **`windows-large`**     | 4        | 16GiB      | 50GiB       |         | Windows           |

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Select a &#x2A;*`snapshot`**
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona, CreateSandboxFromSnapshotParams

    daytona = Daytona()
    sandbox = daytona.create(
        CreateSandboxFromSnapshotParams(
            snapshot="daytona-small",
        )
    )
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()
    const sandbox = await daytona.create({
      snapshot: 'daytona-small',
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new
    sandbox = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        snapshot: 'daytona-small'
      )
    )
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, _ := daytona.NewClient()
    	ctx := context.Background()
    	params := types.SnapshotParams{
    		Snapshot: "daytona-small",
    	}
    	_, _ = client.Create(ctx, params)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setSnapshot("daytona-small");
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona create --snapshot daytona-small
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "snapshot": "daytona-small"
    }'
    ```
  </TabItem>
</Tabs>

### Resources [#resources]

Create a sandbox with custom resources.

Sandboxes have **1 vCPU**, **1GB RAM**, and **3GiB disk** by default. Organizations get a maximum sandbox resource limit of **4 vCPUs**, **8GB RAM**, and **10GB disk**.

| **Resource** | **Unit** | **Default** | **Minimum** | **Maximum** |
| ------------ | -------- | ----------- | ----------- | ----------- |
| CPU          | vCPU     | **`1`**     | **`1`**     | **`4`**     |
| Memory       | GiB      | **`1`**     | **`1`**     | **`8`**     |
| Disk         | GiB      | **`3`**     | **`1`**     | **`10`**    |

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Enter a base <Button>Image</Button&#x3E; (e.g. &#x2A;*`ubuntu:22.04`**) as the source for the sandbox
4. Set <Button>Resources</Button&#x3E; (&#x2A;*`cpu`*&#x2A;, &#x2A;*`memory`*&#x2A;, &#x2A;*`disk`**) to the values within your organization's limits
5. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona, CreateSandboxFromImageParams, Image, Resources

    daytona = Daytona()
    sandbox = daytona.create(
        CreateSandboxFromImageParams(
            image="ubuntu:22.04",
            resources=Resources(cpu=2, memory=4, disk=8),
        )
    )
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona, Image } from '@daytona/sdk'

    const daytona = new Daytona()
    const sandbox = await daytona.create({
      image: Image.base('ubuntu:22.04'),
      resources: { cpu: 2, memory: 4, disk: 8 },
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new
    sandbox = daytona.create(
      Daytona::CreateSandboxFromImageParams.new(
        image: Daytona::Image.base('ubuntu:22.04'),
        resources: Daytona::Resources.new(
          cpu: 2,
          memory: 4,
          disk: 8
        )
      )
    )
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, _ := daytona.NewClient()
    	ctx := context.Background()
    	_, _ = client.Create(ctx, types.ImageParams{
    		Image: "ubuntu:22.04",
    		Resources: &types.Resources{
    			CPU:    2,
    			Memory: 4,
    			Disk:   8,
    		},
    	})
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromImageParams;
    import io.daytona.sdk.model.Resources;

    final class CreateSandboxResources {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromImageParams params = new CreateSandboxFromImageParams();
                params.setImage("ubuntu:22.04");
                Resources resources = new Resources();
                resources.setCpu(2);
                resources.setMemory(4);
                resources.setDisk(8);
                params.setResources(resources);
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona create --cpu 2 --memory 4 --disk 8
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "image": "ubuntu:22.04",
      "cpu": 2,
      "memory": 4,
      "disk": 8
    }'
    ```
  </TabItem>
</Tabs>

<a id="multiple-runtime-support" />

### Languages [#languages]

Create a sandbox with a specific language runtime.

Daytona sandboxes support **Python**, **TypeScript**, and **JavaScript** programming language runtimes for direct code execution inside the sandbox. The `language` parameter controls which programming language runtime is used for the sandbox. If omitted, it defaults to `python`.

* **`python`**
* **`typescript`**
* **`javascript`**

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona, CreateSandboxFromSnapshotParams

    daytona = Daytona()

    # Python runtime (default)
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(language="python"))
    response = sandbox.process.code_run('print("Hello from Python")')
    print(response.result)

    # TypeScript runtime
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(language="typescript"))
    response = sandbox.process.code_run('console.log("Hello from TypeScript")')
    print(response.result)

    # JavaScript runtime
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(language="javascript"))
    response = sandbox.process.code_run('console.log("Hello from JavaScript")')
    print(response.result)
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()

    // Python runtime (default)
    let sandbox = await daytona.create({ language: 'python' })
    let response = await sandbox.process.codeRun('print("Hello from Python")')
    console.log(response.result)

    // TypeScript runtime
    sandbox = await daytona.create({ language: 'typescript' })
    response = await sandbox.process.codeRun('console.log("Hello from TypeScript")')
    console.log(response.result)

    // JavaScript runtime
    sandbox = await daytona.create({ language: 'javascript' })
    response = await sandbox.process.codeRun('console.log("Hello from JavaScript")')
    console.log(response.result)
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new

    # Python runtime (default)
    sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(
      language: Daytona::CodeLanguage::PYTHON
    ))
    response = sandbox.process.code_run(code: 'print("Hello from Python")')
    puts response.result

    # TypeScript runtime
    sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(
      language: Daytona::CodeLanguage::TYPESCRIPT
    ))
    response = sandbox.process.code_run(code: 'console.log("Hello from TypeScript")')
    puts response.result

    # JavaScript runtime
    sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(
      language: Daytona::CodeLanguage::JAVASCRIPT
    ))
    response = sandbox.process.code_run(code: 'console.log("Hello from JavaScript")')
    puts response.result
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"fmt"
    	"log"

    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, err := daytona.NewClient()
    	if err != nil {
    		log.Fatal(err)
    	}
    	ctx := context.Background()

    	// Python runtime (default)
    	sandbox, err := client.Create(ctx, types.SnapshotParams{
    		SandboxBaseParams: types.SandboxBaseParams{Language: types.CodeLanguagePython},
    	})
    	if err != nil {
    		log.Fatal(err)
    	}
    	result, err := sandbox.Process.CodeRun(ctx, `print("Hello from Python")`)
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(result.Result)

    	// TypeScript runtime
    	sandbox, err = client.Create(ctx, types.SnapshotParams{
    		SandboxBaseParams: types.SandboxBaseParams{Language: types.CodeLanguageTypeScript},
    	})
    	if err != nil {
    		log.Fatal(err)
    	}
    	result, err = sandbox.Process.CodeRun(ctx, `console.log("Hello from TypeScript")`)
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(result.Result)

    	// JavaScript runtime
    	sandbox, err = client.Create(ctx, types.SnapshotParams{
    		SandboxBaseParams: types.SandboxBaseParams{Language: types.CodeLanguageJavaScript},
    	})
    	if err != nil {
    		log.Fatal(err)
    	}
    	result, err = sandbox.Process.CodeRun(ctx, `console.log("Hello from JavaScript")`)
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(result.Result)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;
    import io.daytona.sdk.model.ExecuteResponse;

    Daytona daytona = new Daytona();

    // Python runtime (default)
    CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
    params.setLanguage("python");
    Sandbox sandbox = daytona.create(params);
    ExecuteResponse response = sandbox.process.codeRun("print(\"Hello from Python\")");
    System.out.println(response.getResult());

    // TypeScript runtime
    params = new CreateSandboxFromSnapshotParams();
    params.setLanguage("typescript");
    sandbox = daytona.create(params);
    response = sandbox.process.codeRun("console.log(\"Hello from TypeScript\")");
    System.out.println(response.getResult());

    // JavaScript runtime
    params = new CreateSandboxFromSnapshotParams();
    params.setLanguage("javascript");
    sandbox = daytona.create(params);
    response = sandbox.process.codeRun("console.log(\"Hello from JavaScript\")");
    System.out.println(response.getResult());
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    # Python runtime (default)
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "language": "python"
    }'

    # TypeScript runtime
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "language": "typescript"
    }'

    # JavaScript runtime
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "language": "javascript"
    }'
    ```
  </TabItem>
</Tabs>

### Environment variables [#environment-variables]

Create a sandbox with environment variables. Use [secrets](/docs/en/secrets) for API keys, tokens, and passwords.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona, CreateSandboxFromSnapshotParams

    daytona = Daytona()
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(
        env_vars={"DEBUG": "true", "LOG_LEVEL": "info"},
    ))
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()
    const sandbox = await daytona.create({
      envVars: { DEBUG: 'true', LOG_LEVEL: 'info' },
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new
    sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(
      env_vars: { 'DEBUG' => 'true', 'LOG_LEVEL' => 'info' }
    ))
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"log"

    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, err := daytona.NewClient()
    	if err != nil {
    		log.Fatal(err)
    	}

    	sandbox, err := client.Create(context.Background(), types.SnapshotParams{
    		SandboxBaseParams: types.SandboxBaseParams{
    			EnvVars: map[string]string{
    				"DEBUG":     "true",
    				"LOG_LEVEL": "info",
    			},
    		},
    	})
    	if err != nil {
    		log.Fatal(err)
    	}
    	log.Printf("Sandbox ID: %s", sandbox.ID)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    import java.util.Map;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setEnvVars(Map.of("DEBUG", "true", "LOG_LEVEL", "info"));
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona create -e DEBUG=true -e LOG_LEVEL=info
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --header 'Content-Type: application/json' \
      --data '{
      "env": {
        "DEBUG": "true",
        "LOG_LEVEL": "info"
      }
    }'
    ```
  </TabItem>
</Tabs>

### Regions [#regions]

Create a sandbox in a specific [region](/docs/en/regions).

| **Region**    | **Target** |
| ------------- | ---------- |
| United States | **`us`**   |
| Europe        | **`eu`**   |

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Set <Button>Region</Button> to the target region you want to create the sandbox in
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona, DaytonaConfig

    daytona = Daytona(DaytonaConfig(target="us"))
    sandbox = daytona.create()
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona({ target: 'us' })
    const sandbox = await daytona.create()
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new(Daytona::Config.new(target: 'us'))
    sandbox = daytona.create
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"

    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, _ := daytona.NewClientWithConfig(&types.DaytonaConfig{
    		Target: "us",
    	})
    	ctx := context.Background()
    	_, _ = client.Create(ctx, nil)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.DaytonaConfig;
    import io.daytona.sdk.Sandbox;

    public class App {
        public static void main(String[] args) {
            DaytonaConfig config = new DaytonaConfig.Builder()
                    .apiKey(System.getenv("DAYTONA_API_KEY"))
                    .target("us")
                    .build();

            try (Daytona daytona = new Daytona(config)) {
                Sandbox sandbox = daytona.create();
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "target": "us"
    }'
    ```
  </TabItem>
</Tabs>

## VM sandboxes [#vm-sandboxes]

Daytona provides **VM sandboxes** for workloads that require a full virtual machine with a dedicated **Linux VM** or **Windows** operating system.

VM sandboxes are distinct from container sandboxes and support VM-only capabilities:

* [Fork sandboxes](#fork-sandboxes)
* [Pause and resume sandboxes](#pause--resume-sandboxes)
* [Create snapshot from sandbox](#create-snapshot-from-sandbox)

<Callout type="note" title="Limitations">
  VM sandboxes can currently only be created from existing VM snapshots. Dynamic builds through the declarative builder are supported for container sandboxes only.
</Callout>

<Tabs>
  <TabItem label="Linux VM" icon="linux">
    <Tabs syncKey="linux-vm-create">
      <TabItem label="Create from snapshot">
        Create a Linux VM sandbox from a default snapshot.

        1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)

        2. Click <Button>Create Sandbox</Button>

        3. Select a Linux VM snapshot:

           * **`daytona-vm-small`**
           * **`daytona-vm-medium`**
           * **`daytona-vm-large`**

        4. Click <Button>Create</Button>

        <Tabs syncKey="language">
          <TabItem label="Python" icon="seti:python">
            ```python
            from daytona import Daytona, CreateSandboxFromSnapshotParams

            daytona = Daytona()
            sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="daytona-vm-small"))
            ```
          </TabItem>

          <TabItem label="TypeScript" icon="seti:typescript">
            ```typescript
            import { Daytona } from '@daytona/sdk'

            const daytona = new Daytona()
            const sandbox = await daytona.create({ snapshot: 'daytona-vm-small' })
            ```
          </TabItem>

          <TabItem label="Ruby" icon="seti:ruby">
            ```ruby
            require 'daytona'

            daytona = Daytona::Daytona.new
            sandbox = daytona.create(
              Daytona::CreateSandboxFromSnapshotParams.new(
                snapshot: 'daytona-vm-small'
              )
            )
            ```
          </TabItem>

          <TabItem label="Go" icon="seti:go">
            ```go
            package main

            import (
            	"context"

            	"github.com/daytona/clients/sdk-go/pkg/daytona"
            	"github.com/daytona/clients/sdk-go/pkg/types"
            )

            func main() {
            	client, _ := daytona.NewClient()
            	ctx := context.Background()
            	params := types.SnapshotParams{
            		Snapshot: "daytona-vm-small",
            	}
            	_, _ = client.Create(ctx, params)
            }
            ```
          </TabItem>

          <TabItem label="Java" icon="seti:java">
            ```java
            import io.daytona.sdk.Daytona;
            import io.daytona.sdk.Sandbox;
            import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

            public class App {
                public static void main(String[] args) {
                    try (Daytona daytona = new Daytona()) {
                        CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                        params.setSnapshot("daytona-vm-small");
                        Sandbox sandbox = daytona.create(params);
                    }
                }
            }
            ```
          </TabItem>

          <TabItem label="CLI" icon="seti:shell">
            ```bash
            daytona create --snapshot daytona-vm-small
            ```
          </TabItem>

          <TabItem label="API" icon="seti:json">
            ```bash
            curl 'https://app.daytona.io/api/sandbox' \
              --request POST \
              --header 'Content-Type: application/json' \
              --header 'Authorization: Bearer YOUR_API_KEY' \
              --data '{
              "snapshot": "daytona-vm-small"
            }'
            ```
          </TabItem>
        </Tabs>
      </TabItem>

      <TabItem label="Create from custom snapshot">
        Create a Linux VM sandbox from a custom snapshot.

        1. Create a snapshot from a base &#x2A;*`image`**
        2. Set sandbox class to &#x2A;*`LINUX_VM`**
        3. Create a Linux VM sandbox from the snapshot

        <Tabs syncKey="language">
          <TabItem label="Python" icon="seti:python">
            ```python
            from daytona import (
                Daytona,
                CreateSnapshotParams,
                CreateSandboxFromSnapshotParams,
                SandboxClass,
            )

            daytona = Daytona()

            # 1. Create a VM snapshot (linux-vm class)
            daytona.snapshot.create(
                CreateSnapshotParams(
                    name="my-vm-snapshot",
                    image="ubuntu:22.04",
                    sandbox_class=SandboxClass.LINUX_VM,
                )
            )

            # 2. Create a VM sandbox from the snapshot
            sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-vm-snapshot"))
            ```
          </TabItem>

          <TabItem label="TypeScript" icon="seti:typescript">
            ```typescript
            import { Daytona, SandboxClass } from "@daytona/sdk";

            const daytona = new Daytona();

            // 1. Create a VM snapshot (linux-vm class)
            await daytona.snapshot.create({
              name: "my-vm-snapshot",
              image: "ubuntu:22.04",
              sandboxClass: SandboxClass.LINUX_VM,
            });

            // 2. Create a VM sandbox from the snapshot
            const sandbox = await daytona.create({ snapshot: "my-vm-snapshot" });
            ```
          </TabItem>

          <TabItem label="Ruby" icon="seti:ruby">
            ```ruby
            require 'daytona'

            daytona = Daytona::Daytona.new

            # 1. Create a VM snapshot (linux-vm class)
            daytona.snapshot.create(
              Daytona::CreateSnapshotParams.new(
                name: 'my-vm-snapshot',
                image: 'ubuntu:22.04',
                sandbox_class: DaytonaApiClient::SandboxClass::LINUX_VM
              )
            )

            # 2. Create a VM sandbox from the snapshot
            sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'my-vm-snapshot'))
            ```
          </TabItem>

          <TabItem label="Go" icon="seti:go">
            ```go
            package main

            import (
            	"context"

            	"github.com/daytona/clients/sdk-go/pkg/daytona"
            	"github.com/daytona/clients/sdk-go/pkg/types"
            )

            func main() {
            	client, _ := daytona.NewClient()
            	ctx := context.Background()

            	// 1. Create a VM snapshot (linux-vm class)
            	sandboxClass := types.SandboxClassLinuxVM
            	_, logCh, _ := client.Snapshot.Create(ctx, &types.CreateSnapshotParams{
            		Name:         "my-vm-snapshot",
            		Image:        "ubuntu:22.04",
            		SandboxClass: &sandboxClass,
            	})
            	for range logCh {
            	}

            	// 2. Create a VM sandbox from the snapshot
            	_, _ = client.Create(ctx, types.SnapshotParams{
            		Snapshot: "my-vm-snapshot",
            	})
            }
            ```
          </TabItem>

          <TabItem label="Java" icon="seti:java">
            ```java
            import io.daytona.sdk.Daytona;
            import io.daytona.sdk.Sandbox;
            import io.daytona.api.client.model.SandboxClass;
            import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

            public class App {
                public static void main(String[] args) {
                    try (Daytona daytona = new Daytona()) {
                        // 1. Create a VM snapshot (linux-vm class)
                        daytona.snapshot().create("my-vm-snapshot", "ubuntu:22.04", SandboxClass.LINUX_VM);

                        // 2. Create a VM sandbox from the snapshot
                        CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                        params.setSnapshot("my-vm-snapshot");
                        Sandbox sandbox = daytona.create(params);
                    }
                }
            }
            ```
          </TabItem>

          <TabItem label="CLI" icon="seti:shell">
            ```bash
            # 1. Create a VM snapshot (linux-vm class)
            daytona snapshot create my-vm-snapshot --image ubuntu:22.04 --sandbox-class linux-vm

            # 2. Create a VM sandbox from the snapshot
            daytona create --snapshot my-vm-snapshot
            ```
          </TabItem>

          <TabItem label="API" icon="seti:json">
            ```bash
            # 1. Create a VM snapshot (linux-vm class)
            curl https://app.daytona.io/api/snapshots \
              --request POST \
              --header 'Content-Type: application/json' \
              --header 'Authorization: Bearer YOUR_API_KEY' \
              --data '{
                "name": "my-vm-snapshot",
                "imageName": "ubuntu:22.04",
                "sandboxClass": "linux-vm"
              }'

            # 2. Create a VM sandbox from the snapshot
            curl 'https://app.daytona.io/api/sandbox' \
              --request POST \
              --header 'Content-Type: application/json' \
              --header 'Authorization: Bearer YOUR_API_KEY' \
              --data '{
                "snapshot": "my-vm-snapshot"
              }'
            ```
          </TabItem>
        </Tabs>
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    Create a Windows sandbox.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)

    2. Click <Button>Create Sandbox</Button>

    3. Select a Windows snapshot:

       * **`windows-small`**
       * **`windows-medium`**
       * **`windows-large`**

    4. Click <Button>Create</Button>

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        from daytona import Daytona, CreateSandboxFromSnapshotParams

        daytona = Daytona()
        sandbox = daytona.create(
            CreateSandboxFromSnapshotParams(
                snapshot="windows-small",
            )
        )
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        import { Daytona } from '@daytona/sdk'

        const daytona = new Daytona()
        const sandbox = await daytona.create({
          snapshot: 'windows-small',
        })
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        require 'daytona'

        daytona = Daytona::Daytona.new
        sandbox = daytona.create(
          Daytona::CreateSandboxFromSnapshotParams.new(
            snapshot: 'windows-small'
          )
        )
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        package main

        import (
        	"context"
        	"github.com/daytona/clients/sdk-go/pkg/daytona"
        	"github.com/daytona/clients/sdk-go/pkg/types"
        )

        func main() {
        	client, _ := daytona.NewClient()
        	ctx := context.Background()
        	params := types.SnapshotParams{
        		Snapshot: "windows-small",
        	}
        	_, _ = client.Create(ctx, params)
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

        public class App {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                    params.setSnapshot("windows-small");
                    Sandbox sandbox = daytona.create(params);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona create --snapshot windows-small
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox' \
          --request POST \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "snapshot": "windows-small"
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

## GPU sandboxes [#gpu-sandboxes]

Daytona provides **GPU sandboxes** for workloads that require NVIDIA GPU acceleration, such as model inference, fine-tuning, and CUDA-accelerated compute. GPU sandboxes are ephemeral and support up to **16 vCPUs**, **192GB RAM**, and **512GB disk**. Supported GPU types:

* **NVIDIA H100**
* **NVIDIA H200**
* **NVIDIA RTX Pro 6000**
* **NVIDIA RTX 4090**
* **NVIDIA RTX 5090**

GPU sandboxes are on-demand. See [spot GPU sandboxes](#spot-gpu-sandboxes) for preemptible GPU capacity.

> Due to possible events of temporary GPU scarcity, the target/region requested for GPU sandboxes is ignored by default. If you need access to a specific geographical location, contact us at [support@daytona.io](mailto:support@daytona.io).

<Tabs syncKey="gpu-create">
  <TabItem label="Create from snapshot">
    Create a GPU sandbox from a default snapshot.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click <Button>Create Sandbox</Button>
    3. Select a &#x2A;*`daytona-gpu`** snapshot
    4. Select &#x2A;*`ephemeral`*&#x2A; or set &#x2A;*`auto-delete interval`*&#x2A; to &#x2A;*`0`**
    5. Click <Button>Create</Button>

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        from daytona import Daytona, CreateSandboxFromSnapshotParams

        daytona = Daytona()
        sandbox = daytona.create(
            CreateSandboxFromSnapshotParams(
                snapshot="daytona-gpu",
                auto_delete_interval=0,
            ),
        )
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        import { Daytona } from "@daytona/sdk";

        const daytona = new Daytona()
        const sandbox = await daytona.create({
          snapshot: "daytona-gpu",
          ephemeral: true,
        });
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        require 'daytona'

        daytona = Daytona::Daytona.new
        sandbox = daytona.create(
          Daytona::CreateSandboxFromSnapshotParams.new(
            snapshot: 'daytona-gpu',
            ephemeral: true
          )
        )
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        package main

        import (
        	"context"
        	"github.com/daytona/clients/sdk-go/pkg/daytona"
        	"github.com/daytona/clients/sdk-go/pkg/types"
        )

        func main() {
        	client, _ := daytona.NewClient()
        	ctx := context.Background()
        	params := types.SnapshotParams{
        		Snapshot: "daytona-gpu",
        		SandboxBaseParams: types.SandboxBaseParams{
        			Ephemeral: true,
        		},
        	}
        	_, _ = client.Create(ctx, params)
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

        public class App {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                    params.setSnapshot("daytona-gpu");
                    params.setAutoDeleteInterval(0);
                    Sandbox sandbox = daytona.create(params);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona create --snapshot daytona-gpu --auto-delete 0
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox' \
          --request POST \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "snapshot": "daytona-gpu",
          "autoDeleteInterval": 0
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Create with custom resources">
    Create a GPU sandbox with custom GPU resources: units and types.

    1. Create a sandbox from an &#x2A;*`image`**
    2. Set the &#x2A;*`auto-delete interval`*&#x2A; to &#x2A;*`0`** (ephemeral)
    3. Set the &#x2A;*`GPU`** to the number of GPU units
    4. Specify the &#x2A;*`GPU type`**(s):

       The GPU type field accepts a single value or an ordered list of preferred types.

       Daytona uses the first available type in the order you provide. This lets you fall back from a preferred GPU to an alternative when the first choice is not available.

       * **`H100`**
       * **`H200`**
       * **`RTX-PRO-6000`**
       * **`RTX-4090`**
       * **`RTX-5090`**

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        from daytona import Daytona, CreateSandboxFromImageParams, Image, Resources, GpuType

        daytona = Daytona()
        sandbox = daytona.create(
            CreateSandboxFromImageParams(
                image=Image.debian_slim("3.12"),
                auto_delete_interval=0,
                resources=Resources(
                    gpu=1,
                    gpu_type=[GpuType.H100, GpuType.RTX_PRO_6000],
                ),
            )
        )
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        import { Daytona, GpuType, Image } from "@daytona/sdk";

        const daytona = new Daytona()
        const sandbox = await daytona.create({
          image: Image.debianSlim("3.12"),
          autoDeleteInterval: 0,
          resources: {
            gpu: 1,
            gpuType: [GpuType.H100, GpuType.RTX_PRO_6000],
          },
        });
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        require 'daytona'

        daytona = Daytona::Daytona.new
        sandbox = daytona.create(
          Daytona::CreateSandboxFromImageParams.new(
            image: Daytona::Image.debian_slim('3.12'),
            auto_delete_interval: 0,
            resources: Daytona::Resources.new(
              gpu: 1,
              gpu_type: [Daytona::GpuType::H100, Daytona::GpuType::RTX_PRO_6000]
            )
          )
        )
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        package main

        import (
        	"context"
        	"github.com/daytona/clients/sdk-go/pkg/daytona"
        	"github.com/daytona/clients/sdk-go/pkg/types"
        )

        func main() {
        	client, _ := daytona.NewClient()
        	ctx := context.Background()
        	autoDelete := 0
        	_, _ = client.Create(ctx, types.ImageParams{
        		Image: "python:3.12",
        		SandboxBaseParams: types.SandboxBaseParams{
        			AutoDeleteInterval: &autoDelete,
        		},
        		Resources: &types.Resources{
        			GPU:     1,
        			GpuType: []types.GpuType{types.GpuTypeH100, types.GpuTypeRtxPro6000},
        		},
        	})
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromImageParams;
        import io.daytona.sdk.model.Resources;
        import io.daytona.api.client.model.GpuType;
        import java.util.List;

        final class CreateGpuSandbox {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromImageParams params = new CreateSandboxFromImageParams();
                    params.setImage("python:3.12");
                    params.setAutoDeleteInterval(0);
                    Resources resources = new Resources();
                    resources.setGpu(1);
                    resources.setGpuType(List.of(GpuType.H100, GpuType.RTX_PRO_6000));
                    params.setResources(resources);
                    Sandbox sandbox = daytona.create(params);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox' \
          --request POST \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "image": "python:3.12",
          "autoDeleteInterval": 0,
          "gpu": 1,
          "gpuType": ["H100", "RTX-PRO-6000"]
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

### Spot GPU sandboxes [#spot-gpu-sandboxes]

Spot GPU sandboxes are preemptible and run on GPU capacity that is not being used by reserved (on-demand) sandboxes. A spot GPU sandbox can be terminated at any time without notice when an on-demand GPU sandbox needs the capacity. Daytona does not send a preemption warning or a dedicated preemption webhook. Design workloads to tolerate immediate interruption.

When a spot GPU sandbox is destroyed, normal [sandbox lifecycle state](#sandbox-lifecycle) updates still apply. Daytona records when the preemption occurred with a `spotEvictedAt` timestamp to identify sandboxes destroyed by spot GPU preemption. Sandboxes destroyed by spot GPU preemption remain retrievable for 24 hours.

Spot GPU sandboxes do not count against the organization's GPU quota. Available GPU capacity is the only limit. If no spot GPU is available, create fails immediately.

<Tabs syncKey="gpu-create">
  <TabItem label="Create from snapshot">
    Create a spot GPU sandbox from a default `daytona-gpu` snapshot.

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        from daytona import Daytona, CreateSandboxFromSnapshotParams

        daytona = Daytona()
        sandbox = daytona.create(
            CreateSandboxFromSnapshotParams(
                snapshot="daytona-gpu",
                auto_delete_interval=0,
                spot=True,
            ),
        )
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        import { Daytona } from "@daytona/sdk";

        const daytona = new Daytona()
        const sandbox = await daytona.create({
          snapshot: "daytona-gpu",
          autoDeleteInterval: 0,
          spot: true,
        });
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        require 'daytona'

        daytona = Daytona::Daytona.new
        sandbox = daytona.create(
          Daytona::CreateSandboxFromSnapshotParams.new(
            snapshot: 'daytona-gpu',
            auto_delete_interval: 0,
            spot: true
          )
        )
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        package main

        import (
        	"context"
        	"github.com/daytona/clients/sdk-go/pkg/daytona"
        	"github.com/daytona/clients/sdk-go/pkg/types"
        )

        func main() {
        	client, _ := daytona.NewClient()
        	ctx := context.Background()
        	autoDelete := 0
        	params := types.SnapshotParams{
        		Snapshot: "daytona-gpu",
        		SandboxBaseParams: types.SandboxBaseParams{
        			AutoDeleteInterval: &autoDelete,
        			Spot:               true,
        		},
        	}
        	_, _ = client.Create(ctx, params)
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

        public class App {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                    params.setSnapshot("daytona-gpu");
                    params.setAutoDeleteInterval(0);
                    params.setSpot(true);
                    Sandbox sandbox = daytona.create(params);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox' \
          --request POST \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "snapshot": "daytona-gpu",
          "autoDeleteInterval": 0,
          "spot": true
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Create with custom resources">
    Create a spot GPU sandbox with custom GPU resources: units and types.

    1. Create a sandbox from an &#x2A;*`image`**
    2. Set the &#x2A;*`auto-delete interval`*&#x2A; to &#x2A;*`0`** (ephemeral)
    3. Set &#x2A;*`spot`*&#x2A; to &#x2A;*`true`**
    4. Set the &#x2A;*`GPU`** to the number of GPU units
    5. Specify the &#x2A;*`GPU type`**(s):

       The GPU type field accepts a single value or an ordered list of preferred types.

       Daytona uses the first available type in the order you provide. This lets you fall back from a preferred GPU to an alternative when the first choice is not available.

       * **`H100`**
       * **`H200`**
       * **`RTX-PRO-6000`**
       * **`RTX-4090`**
       * **`RTX-5090`**

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        from daytona import Daytona, CreateSandboxFromImageParams, Image, Resources, GpuType

        daytona = Daytona()
        sandbox = daytona.create(
            CreateSandboxFromImageParams(
                image=Image.debian_slim("3.12"),
                auto_delete_interval=0,
                spot=True,
                resources=Resources(
                    gpu=1,
                    gpu_type=[GpuType.H100, GpuType.RTX_PRO_6000],
                ),
            )
        )
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        import { Daytona, GpuType, Image } from "@daytona/sdk";

        const daytona = new Daytona()
        const sandbox = await daytona.create({
          image: Image.debianSlim("3.12"),
          autoDeleteInterval: 0,
          spot: true,
          resources: {
            gpu: 1,
            gpuType: [GpuType.H100, GpuType.RTX_PRO_6000],
          },
        });
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        require 'daytona'

        daytona = Daytona::Daytona.new
        sandbox = daytona.create(
          Daytona::CreateSandboxFromImageParams.new(
            image: Daytona::Image.debian_slim('3.12'),
            auto_delete_interval: 0,
            spot: true,
            resources: Daytona::Resources.new(
              gpu: 1,
              gpu_type: [Daytona::GpuType::H100, Daytona::GpuType::RTX_PRO_6000]
            )
          )
        )
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        package main

        import (
        	"context"
        	"github.com/daytona/clients/sdk-go/pkg/daytona"
        	"github.com/daytona/clients/sdk-go/pkg/types"
        )

        func main() {
        	client, _ := daytona.NewClient()
        	ctx := context.Background()
        	autoDelete := 0
        	_, _ = client.Create(ctx, types.ImageParams{
        		Image: "python:3.12",
        		SandboxBaseParams: types.SandboxBaseParams{
        			AutoDeleteInterval: &autoDelete,
        			Spot:               true,
        		},
        		Resources: &types.Resources{
        			GPU:     1,
        			GpuType: []types.GpuType{types.GpuTypeH100, types.GpuTypeRtxPro6000},
        		},
        	})
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromImageParams;
        import io.daytona.sdk.model.Resources;
        import io.daytona.api.client.model.GpuType;
        import java.util.List;

        final class CreateSpotGpuSandbox {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromImageParams params = new CreateSandboxFromImageParams();
                    params.setImage("python:3.12");
                    params.setAutoDeleteInterval(0);
                    params.setSpot(true);
                    Resources resources = new Resources();
                    resources.setGpu(1);
                    resources.setGpuType(List.of(GpuType.H100, GpuType.RTX_PRO_6000));
                    params.setResources(resources);
                    Sandbox sandbox = daytona.create(params);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox' \
          --request POST \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "image": "python:3.12",
          "autoDeleteInterval": 0,
          "spot": true,
          "gpu": 1,
          "gpuType": ["H100", "RTX-PRO-6000"]
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

## Ephemeral sandboxes [#ephemeral-sandboxes]

Create an ephemeral sandbox. Ephemeral sandboxes are automatically deleted when stopped.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Set <Button>Ephemeral</Button> or set the [auto-delete interval](#auto-delete-interval&#x29; to &#x2A;*`0`**
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import Daytona, CreateSandboxFromSnapshotParams

    daytona = Daytona()
    params = CreateSandboxFromSnapshotParams(
        ephemeral=True,
        auto_stop_interval=5,
    )
    sandbox = daytona.create(params)
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()
    const sandbox = await daytona.create({
      ephemeral: true,
      autoStopInterval: 5,
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new
    params = Daytona::CreateSandboxFromSnapshotParams.new(
      ephemeral: true,
      auto_stop_interval: 5
    )
    sandbox = daytona.create(params)
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, _ := daytona.NewClient()
    	ctx := context.Background()

    	autoStopInterval := 5
    	params := types.SnapshotParams{
    		SandboxBaseParams: types.SandboxBaseParams{
    			Language:         types.CodeLanguagePython,
    			Ephemeral:        true,
    			AutoStopInterval: &autoStopInterval,
    		},
    	}
    	_, _ = client.Create(ctx, params)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setAutoDeleteInterval(0);
                params.setAutoStopInterval(5);
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona create --auto-delete 0 --auto-stop 5
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "autoDeleteInterval": 0,
      "autoStopInterval": 5
    }'
    ```
  </TabItem>
</Tabs>

## Linked sandboxes [#linked-sandboxes]

Create a linked sandbox. Linked sandboxes attach ephemeral child sandboxes to a parent. Daytona schedules each child on the same runner as the parent and joins them into a shared link network so the group can communicate over local connections.

* **Lifecycle**

  Linked sandboxes are always ephemeral and cannot be persisted or resumed after stop. The [auto-delete interval](#auto-delete-interval) must be exactly `0` on create; this is enforced, not a default. The [auto-stop interval](#auto-stop-interval) sets the idle period in minutes after which the child sandbox stops. Once stopped, linked children are auto-deleted. Deleting the parent deletes all of its linked children (cascade). One parent may have many linked children (1:N).

* **Networking**

  Linked sandboxes share an internal link network. Connections work in both directions: the parent can reach each child and each child can reach the parent. Every sandbox on the link network is registered under its sandbox name and ID as DNS aliases, so either works as the host. For example: `telnet LINKED_SANDBOX_ID 5555` from the parent reaches port `5555` on the linked child sandbox.

1. Create a parent sandbox
2. Create one or more child sandboxes that reference the parent's sandbox ID.

This records the relationship on the child sandbox as the linked sandbox ID. Omitting the linked sandbox parameter yields an unlinked sandbox.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    from daytona import CreateSandboxFromSnapshotParams, Daytona

    daytona = Daytona()

    parent = daytona.create()

    child = daytona.create(
        CreateSandboxFromSnapshotParams(
            linked_sandbox=parent.id,
            ephemeral=True,
        )
    )

    # The link network registers each sandbox under its name as a DNS alias
    response = child.process.exec(f"curl http://{parent.name}:3000/")
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()

    const parent = await daytona.create()

    const child = await daytona.create({
      linkedSandbox: parent.id,
      ephemeral: true,
    })

    // The link network registers each sandbox under its name as a DNS alias
    const response = await child.process.executeCommand(
      `curl http://${parent.name}:3000/`
    )
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    require 'daytona'

    daytona = Daytona::Daytona.new

    parent = daytona.create

    child = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        linked_sandbox: parent.id,
        ephemeral: true
      )
    )

    # The link network registers each sandbox under its name and ID as DNS aliases.
    # The Ruby SDK does not expose the sandbox name, so address the parent by ID.
    response = child.process.exec(command: "curl http://#{parent.id}:3000/")
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    package main

    import (
    	"context"
    	"fmt"

    	"github.com/daytona/clients/sdk-go/pkg/daytona"
    	"github.com/daytona/clients/sdk-go/pkg/types"
    )

    func main() {
    	client, _ := daytona.NewClient()
    	ctx := context.Background()

    	parent, _ := client.Create(ctx, types.SnapshotParams{})

    	child, _ := client.Create(ctx, types.SnapshotParams{
    		SandboxBaseParams: types.SandboxBaseParams{
    			LinkedSandbox: parent.ID,
    			Ephemeral:     true,
    		},
    	})

    	// The link network registers each sandbox under its name as a DNS alias
    	response, _ := child.Process.ExecuteCommand(ctx, fmt.Sprintf("curl http://%s:3000/", parent.Name))
    	fmt.Println(response.Result)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;
    import io.daytona.sdk.model.ExecuteResponse;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                Sandbox parent = daytona.create();

                CreateSandboxFromSnapshotParams childParams = new CreateSandboxFromSnapshotParams();
                childParams.setLinkedSandbox(parent.getId());
                childParams.setAutoDeleteInterval(0); // linked sandboxes must be ephemeral
                Sandbox child = daytona.create(childParams);

                // The link network registers each sandbox under its name as a DNS alias
                ExecuteResponse response = child.getProcess()
                        .executeCommand("curl http://" + parent.getName() + ":3000/");
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    # Create parent sandbox
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{}'

    # Create linked child sandbox (replace PARENT_SANDBOX_ID with the id from the first response)
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "linkedSandbox": "PARENT_SANDBOX_ID",
      "autoDeleteInterval": 0
    }'
    ```
  </TabItem>
</Tabs>

## Start sandboxes [#start-sandboxes]

Start a sandbox.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click the start icon (&#x2A;*▶**) next to the sandbox you want to start

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox.start()
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    await sandbox.start()
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox.start
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    sandbox.Start(ctx)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    sandbox.start();
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona start [SANDBOX_ID] | [SANDBOX_NAME] [flags]
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/start' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

## Get sandbox [#get-sandbox]

Get a sandbox by ID or name.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox = daytona.get("my-sandbox-id-or-name")
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    const sandbox = await daytona.get('my-sandbox-id-or-name')
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox = daytona.get('my-sandbox-id-or-name')
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    sandbox, err := client.Get(ctx, "my-sandbox-id-or-name")
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    Sandbox sandbox = daytona.get("my-sandbox-id-or-name");
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona info [SANDBOX_ID] | [SANDBOX_NAME] [flags]
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}' \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

## List sandboxes [#list-sandboxes]

List sandboxes.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    for sandbox in daytona.list():
        print(sandbox.id)
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    for await (const sandbox of daytona.list()) {
      console.log(sandbox.id)
    }
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    daytona.list.each { |sandbox| puts sandbox.id }
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    iter := client.List(ctx, nil)
    defer iter.Close()
    for iter.Next() {
        sandbox := iter.Value()
        fmt.Println(sandbox.ID)
    }
    if err := iter.Err(); err != nil {
        log.Fatal(err)
    }
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    Iterator<Map<String, Object>> iter = daytona.list();
    while (iter.hasNext()) {
        Map<String, Object> sandbox = iter.next();
        System.out.println(sandbox.get("id"));
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona list [flags]
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox' \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

## Stop sandboxes [#stop-sandboxes]

Stop a sandbox. The sandbox moves to the **stopped** state when shutdown completes. While a stop is in progress, the sandbox is in the **stopping** state and does not accept new requests.

<Tabs syncKey="sandbox-class">
  <TabItem label="Container" icon="seti:docker">
    Stopping terminates the running container. The filesystem is preserved, but memory state is not. Container sandboxes do not support pause; stop is the way to shut down a container sandbox when it is not in use.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click the stop icon (&#x2A;*⏹**) next to the sandbox you want to stop

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox.stop()
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox.stop()
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.stop
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        sandbox.Stop(ctx)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        sandbox.stop();
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Linux VM" icon="linux">
    Stopping shuts down the virtual machine while preserving the filesystem. Memory state is cleared. To preserve running process state without consuming CPU, use <u>[**pause / resume**](#pause--resume-sandboxes)</u>.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click the stop icon (&#x2A;*⏹**) next to the sandbox you want to stop

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox.stop()
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox.stop()
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.stop
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        sandbox.Stop(ctx)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        sandbox.stop();
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    Stopping shuts down the virtual machine while preserving the filesystem. Memory state is cleared. To preserve running process state without consuming CPU, use <u>[**pause / resume**](#pause--resume-sandboxes)</u>.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click the stop icon (&#x2A;*⏹**) next to the sandbox you want to stop

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox.stop()
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox.stop()
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.stop
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        sandbox.Stop(ctx)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        sandbox.stop();
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

<Callout type="note" title="Force stop">
  If you need a faster shutdown, use force stop (`force=true` / `--force`) to terminate the sandbox immediately. Force stop is ungraceful and should be used when quick termination is more important than process cleanup. Avoid force stop for normal shutdowns where the process should flush buffers, write final state, or run cleanup.
</Callout>

## Archive sandboxes [#archive-sandboxes]

Archive a sandbox.

<Tabs syncKey="sandbox-class">
  <TabItem label="Container" icon="seti:docker">
    Archive moves a stopped sandbox's filesystem to object storage and frees disk quota.

    1. Ensure the sandbox is **stopped**
    2. **Archive** the sandbox
    3. Wait for the sandbox to reach the **archived** state
    4. **Start** the sandbox again when you need to use it

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox.archive()
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox.archive()
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.archive
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        sandbox.Archive(ctx)
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona archive [SANDBOX_ID] | [SANDBOX_NAME] [flags]
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/archive' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Linux VM" icon="linux">
    Archive is not supported for Linux VM sandboxes. Stopping a Linux VM sandbox already offloads filesystem state and releases disk quota, so a separate archive step is not needed.
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    Archive is not supported for Windows sandboxes. Stopping a Windows sandbox already offloads filesystem state and releases disk quota, so a separate archive step is not needed.
  </TabItem>
</Tabs>

<a id="pause-sandboxes" />

## Pause / resume sandboxes [#pause--resume-sandboxes]

Pause and resume a sandbox.

<Tabs syncKey="sandbox-class">
  <TabItem label="Container" icon="seti:docker">
    Pause is not supported for container sandboxes. The filesystem can be preserved on stop, but memory state is not. Use <u>[**stop**](#stop-sandboxes)</u> to shut down a container sandbox when it is not in use.
  </TabItem>

  <TabItem label="Linux VM" icon="linux">
    The filesystem and memory state are preserved, and CPU is no longer consumed.

    1. Ensure the Linux VM sandbox is **started**
    2. **Pause** the Linux VM sandbox
    3. Wait for the Linux VM sandbox to reach the **paused** state
    4. **Resume** (start) the Linux VM sandbox again when you need to resume it

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox.pause()
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox.pause()
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.pause
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        sandbox.Pause(ctx)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        sandbox.pause();
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona pause [SANDBOX_ID] | [SANDBOX_NAME]
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/pause' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    The filesystem and memory state are preserved, and CPU is no longer consumed.

    1. Ensure the Windows sandbox is **started**
    2. **Pause** the Windows sandbox
    3. Wait for the Windows sandbox to reach the **paused** state
    4. **Resume** (start) the Windows sandbox again when you need to resume it

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox.pause()
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox.pause()
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.pause
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        sandbox.Pause(ctx)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        sandbox.pause();
        ```
      </TabItem>

      <TabItem label="CLI" icon="seti:shell">
        ```bash
        daytona pause [SANDBOX_ID] | [SANDBOX_NAME]
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/pause' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

## Recover sandboxes [#recover-sandboxes]

Recover a sandbox.

1. Ensure the sandbox is in **error** state
2. Check that the sandbox is **recoverable**
3. Resolve any underlying issue that requires user intervention
4. **Recover** the sandbox and wait for it to be ready

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    # Check if the sandbox is recoverable
    if sandbox.recoverable:
        sandbox.recover()
    ```

    ```python
    sandbox.recover()
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    // Check if the sandbox is recoverable
    if (sandbox.recoverable) {
      await sandbox.recover()
    }
    ```

    ```typescript
    await sandbox.recover()
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    # Check if the sandbox is in an error state before recovering
    if sandbox.state == 'error'
      sandbox.recover
    end
    ```

    ```ruby
    sandbox.recover
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/recover' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```

    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/recover' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

## Resize sandboxes [#resize-sandboxes]

Resizing updates the sandbox resource allocation (`cpu`, `memory`, and `disk`) for that sandbox. CPU and memory control compute capacity for running workloads, while disk controls persistent filesystem capacity.

On a running sandbox, you can increase CPU and memory without interruption. To decrease CPU or memory, or to increase disk capacity, stop the sandbox first. Disk size can only be increased and cannot be decreased.

1. Choose the new **CPU**, **memory**, and **disk** values within your organization's limits
2. Ensure the sandbox is **stopped** if you need to decrease CPU or memory, or increase disk
3. **Resize** the sandbox with the new resource values
4. **Start** the sandbox

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    # Resize a started sandbox (CPU and memory can be increased)
    sandbox.resize(Resources(cpu=2, memory=4))

    # Resize a stopped sandbox (CPU and memory can change, disk can only increase)
    sandbox.stop()
    sandbox.resize(Resources(cpu=4, memory=8, disk=20))
    sandbox.start()
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    // Resize a started sandbox (CPU and memory can be increased)
    await sandbox.resize({ cpu: 2, memory: 4 })

    // Resize a stopped sandbox (CPU and memory can change, disk can only increase)
    await sandbox.stop()
    await sandbox.resize({ cpu: 4, memory: 8, disk: 20 })
    await sandbox.start()
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    # Resize a started sandbox (CPU and memory can be increased)
    sandbox.resize(Daytona::Resources.new(cpu: 2, memory: 4))

    # Resize a stopped sandbox (CPU and memory can change, disk can only increase)
    sandbox.stop
    sandbox.resize(Daytona::Resources.new(cpu: 4, memory: 8, disk: 20))
    sandbox.start
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    // Resize a started sandbox (CPU and memory can be increased)
    err := sandbox.Resize(ctx, &types.Resources{CPU: 2, Memory: 4})

    // Resize a stopped sandbox (CPU and memory can change, disk can only increase)
    err = sandbox.Stop(ctx)
    err = sandbox.Resize(ctx, &types.Resources{CPU: 4, Memory: 8, Disk: 20})
    err = sandbox.Start(ctx)
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/resize' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "cpu": 2,
      "memory": 4,
      "disk": 20
    }'
    ```
  </TabItem>
</Tabs>

To verify CPU and memory limits inside the sandbox after resizing, read `cgroup` values directly. Tools such as `nproc`, `free`, `top`, `htop`, `/proc/cpuinfo`, and `/proc/meminfo` read host-level values and do not reflect sandbox resource limits.

```bash
cat /sys/fs/cgroup/cpu.max      # "<quota> <period>" (cores = quota / period)
cat /sys/fs/cgroup/memory.max   # bytes
df -h /                         # disk
```

## Label sandboxes [#label-sandboxes]

Set sandbox labels.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Click <Button>Add Labels</Button>
4. Enter the labels in key-value pairs

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox.set_labels({
        "team": "platform",
        "env": "staging",
    })
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    await sandbox.setLabels({
      team: 'platform',
      env: 'staging',
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox.labels = {
      team: 'platform',
      env: 'staging'
    }
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    err := sandbox.SetLabels(ctx, map[string]string{
    	"team": "platform",
    	"env":  "staging",
    })
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    Map<String, String> labels = new HashMap<>();
    labels.put("team", "platform");
    labels.put("env", "staging");
    sandbox.setLabels(labels);
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/labels' \
      --request PUT \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "labels": {
        "team": "platform",
        "env": "staging"
      }
    }'
    ```
  </TabItem>
</Tabs>

## Delete sandboxes [#delete-sandboxes]

Delete a sandbox.

By default `delete` is fire-and-forget: it returns as soon as the API accepts the deletion request, without waiting for the sandbox to be destroyed. Pass the `wait` flag to block until the sandbox reaches the destroyed state.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Delete</Button> next to the sandbox you want to delete.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox.delete()

    # Block until the sandbox is destroyed
    sandbox.delete(timeout=60, wait=True)
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    await sandbox.delete()

    // Block until the sandbox is destroyed
    await sandbox.delete(60, true)
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox.delete

    # Block until the sandbox is destroyed
    sandbox.delete(60, wait: true)
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    err = sandbox.Delete(ctx)

    // Block until the sandbox is destroyed
    err = sandbox.DeleteAndWait(ctx, 60*time.Second)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    sandbox.delete();

    // Block until the sandbox is destroyed
    sandbox.delete(60, true);
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    daytona delete [SANDBOX_ID] | [SANDBOX_NAME] [flags]
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}' \
      --request DELETE \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

## Create snapshot from sandbox [#create-snapshot-from-sandbox]

Create a snapshot from a running or stopped sandbox.

<Tabs syncKey="sandbox-class">
  <TabItem label="Container" icon="seti:docker">
    Container sandboxes capture filesystem state only (**cold snapshot**):

    | **Snapshot type** | **Include memory**    | **Snapshot contents** | **Required sandbox state** |
    | ----------------- | --------------------- | --------------------- | -------------------------- |
    | Cold              | **`false`** (default) | Filesystem only       | Stopped                    |

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox._experimental_create_snapshot("my-snapshot")
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        await sandbox._experimental_createSnapshot('my-snapshot')
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox.experimental_create_snapshot(name: 'my-snapshot')
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        err := sandbox.ExperimentalCreateSnapshot(ctx, "my-snapshot")
        if err != nil {
            return err
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        sandbox.experimentalCreateSnapshot("my-snapshot");
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/snapshot' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-snapshot",
          "includeMemory": false
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Linux VM" icon="linux">
    Linux VM sandboxes capture filesystem state only (**cold snapshot**) or filesystem and memory state (**hot snapshot**) through the `includeMemory` parameter:

    | **Snapshot type** | **Include memory**    | **Snapshot contents** | **Required sandbox state** |
    | ----------------- | --------------------- | --------------------- | -------------------------- |
    | Cold              | **`false`** (default) | Filesystem only       | Stopped                    |
    | Hot               | **`true`**            | Filesystem and memory | Started                    |

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        # Cold snapshot (filesystem only, sandbox stopped)
        sandbox._experimental_create_snapshot("my-snapshot")

        # Hot snapshot (filesystem and memory, sandbox running)
        sandbox._experimental_create_snapshot("my-vm-snapshot", include_memory=True)
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        // Cold snapshot (filesystem only, sandbox stopped)
        await sandbox._experimental_createSnapshot('my-snapshot')

        // Hot snapshot (filesystem and memory, sandbox running)
        await sandbox._experimental_createSnapshot('my-vm-snapshot', 60, true)
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        # Cold snapshot (filesystem only, sandbox stopped)
        sandbox.experimental_create_snapshot(name: 'my-snapshot')

        # Hot snapshot (filesystem and memory, sandbox running)
        sandbox.experimental_create_snapshot(name: 'my-vm-snapshot', include_memory: true)
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        // Cold snapshot (filesystem only, sandbox stopped)
        err := sandbox.ExperimentalCreateSnapshot(ctx, "my-snapshot")
        if err != nil {
            return err
        }

        // Hot snapshot (filesystem and memory, sandbox running)
        err = sandbox.ExperimentalCreateSnapshotWithMemory(ctx, "my-vm-snapshot", 60*time.Second)
        if err != nil {
            return err
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        // Cold snapshot (filesystem only, sandbox stopped)
        sandbox.experimentalCreateSnapshot("my-snapshot");

        // Hot snapshot (filesystem and memory, sandbox running)
        sandbox.experimentalCreateSnapshot("my-vm-snapshot", 60, true);
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        # Cold snapshot (filesystem only, sandbox stopped)
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/snapshot' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-snapshot",
          "includeMemory": false
        }'

        # Hot snapshot (filesystem and memory, sandbox running)
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/snapshot' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-vm-snapshot",
          "includeMemory": true
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    Windows sandboxes capture filesystem state only (**cold snapshot**) or filesystem and memory state (**hot snapshot**) through the `includeMemory` parameter:

    | **Snapshot type** | **Include memory**    | **Snapshot contents** | **Required sandbox state** |
    | ----------------- | --------------------- | --------------------- | -------------------------- |
    | Cold              | **`false`** (default) | Filesystem only       | Stopped                    |
    | Hot               | **`true`**            | Filesystem and memory | Started                    |

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        # Cold snapshot (filesystem only, sandbox stopped)
        sandbox._experimental_create_snapshot("my-snapshot")

        # Hot snapshot (filesystem and memory, sandbox running)
        sandbox._experimental_create_snapshot("my-vm-snapshot", include_memory=True)
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        // Cold snapshot (filesystem only, sandbox stopped)
        await sandbox._experimental_createSnapshot('my-snapshot')

        // Hot snapshot (filesystem and memory, sandbox running)
        await sandbox._experimental_createSnapshot('my-vm-snapshot', 60, true)
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        # Cold snapshot (filesystem only, sandbox stopped)
        sandbox.experimental_create_snapshot(name: 'my-snapshot')

        # Hot snapshot (filesystem and memory, sandbox running)
        sandbox.experimental_create_snapshot(name: 'my-vm-snapshot', include_memory: true)
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        // Cold snapshot (filesystem only, sandbox stopped)
        err := sandbox.ExperimentalCreateSnapshot(ctx, "my-snapshot")
        if err != nil {
            return err
        }

        // Hot snapshot (filesystem and memory, sandbox running)
        err = sandbox.ExperimentalCreateSnapshotWithMemory(ctx, "my-vm-snapshot", 60*time.Second)
        if err != nil {
            return err
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        // Cold snapshot (filesystem only, sandbox stopped)
        sandbox.experimentalCreateSnapshot("my-snapshot");

        // Hot snapshot (filesystem and memory, sandbox running)
        sandbox.experimentalCreateSnapshot("my-vm-snapshot", 60, true);
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        # Cold snapshot (filesystem only, sandbox stopped)
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/snapshot' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-snapshot",
          "includeMemory": false
        }'

        # Hot snapshot (filesystem and memory, sandbox running)
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/snapshot' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-vm-snapshot",
          "includeMemory": true
        }'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

## Fork sandboxes [#fork-sandboxes]

Fork a sandbox.

<Tabs syncKey="sandbox-class">
  <TabItem label="Container" icon="seti:docker">
    Forking is not supported for container sandboxes. Use <u>[**create snapshot from sandbox**](#create-snapshot-from-sandbox)</u> to capture filesystem state, then create a new sandbox from that snapshot.
  </TabItem>

  <TabItem label="Linux VM" icon="linux">
    Forking creates a duplicate of a Linux VM sandbox's filesystem and memory state in a new sandbox. The forked sandbox is fully independent: it can be started, stopped, and deleted without affecting the original.

    Daytona tracks the parent-child relationship in a fork tree, so you can trace a fork's lineage back to the sandbox it was created from. You can fork a fork to build branches. The parent sandbox cannot be deleted while it has active fork children.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click the three-dot menu (&#x2A;*⋮**) next to the started Linux VM sandbox you want to fork
    3. Select <Button>Fork</Button>

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        # Fork sandbox through the Sandbox instance
        forked = sandbox.fork(name="my-forked-sandbox")
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        // Fork sandbox through the Sandbox instance
        const forkedSandbox = await sandbox.fork({ name: "my-forked-sandbox" });

        // Or use the Daytona helper method
        const forkedSandbox = await daytona.fork(sandbox, { name: "my-forked-sandbox" });
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        # Fork sandbox through the Sandbox instance
        forkedSandbox = sandbox.fork(name: "my-forked-sandbox")
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        // Fork sandbox through the Sandbox instance
        name := "my-forked-sandbox"
        forkedSandbox, err := sandbox.Fork(ctx, &name)
        if err != nil {
            return err
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        // Fork sandbox through the Sandbox instance
        Sandbox forkedSandbox = sandbox.fork("my-forked-sandbox", 60);
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/fork' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-forked-sandbox"
        }'
        ```

        Query fork relationships:

        ```bash
        # List direct fork children of a sandbox
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/forks' \
          --header 'Authorization: Bearer YOUR_API_KEY'

        # Get the parent sandbox of a fork
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/parent' \
          --header 'Authorization: Bearer YOUR_API_KEY'

        # Get the full ancestor chain (parent, grandparent, and so on)
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/ancestors' \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    Forking creates a duplicate of a Windows sandbox's filesystem and memory state in a new sandbox. The forked sandbox is fully independent: it can be started, stopped, and deleted without affecting the original.

    Daytona tracks the parent-child relationship in a fork tree, so you can trace a fork's lineage back to the sandbox it was created from. You can fork a fork to build branches. The parent sandbox cannot be deleted while it has active fork children.

    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click the three-dot menu (&#x2A;*⋮**) next to the started Windows sandbox you want to fork
    3. Select <Button>Fork</Button>

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        # Fork sandbox through the Sandbox instance
        forked = sandbox.fork(name="my-forked-sandbox")
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        // Fork sandbox through the Sandbox instance
        const forkedSandbox = await sandbox.fork({ name: "my-forked-sandbox" });

        // Or use the Daytona helper method
        const forkedSandbox = await daytona.fork(sandbox, { name: "my-forked-sandbox" });
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        # Fork sandbox through the Sandbox instance
        forkedSandbox = sandbox.fork(name: "my-forked-sandbox")
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        // Fork sandbox through the Sandbox instance
        name := "my-forked-sandbox"
        forkedSandbox, err := sandbox.Fork(ctx, &name)
        if err != nil {
            return err
        }
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        // Fork sandbox through the Sandbox instance
        Sandbox forkedSandbox = sandbox.fork("my-forked-sandbox", 60);
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/fork' \
          --request POST \
          --header 'X-Daytona-Organization-ID: YOUR_ORGANIZATION_ID' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer YOUR_API_KEY' \
          --data '{
          "name": "my-forked-sandbox"
        }'
        ```

        Query fork relationships:

        ```bash
        # List direct fork children of a sandbox
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/forks' \
          --header 'Authorization: Bearer YOUR_API_KEY'

        # Get the parent sandbox of a fork
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/parent' \
          --header 'Authorization: Bearer YOUR_API_KEY'

        # Get the full ancestor chain (parent, grandparent, and so on)
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/ancestors' \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>
</Tabs>

## Sandbox lifecycle [#sandbox-lifecycle]

Every sandbox moves through a lifecycle. A sandbox can have several different states. Each state reflects the status of your sandbox. A sandbox transitions between states in response to user actions, or through [automated lifecycle management](#automated-lifecycle-management) based on inactivity intervals. Available lifecycle features depend on the sandbox class.

| **Lifecycle feature**                             | **Container** | **Linux VM** | **Windows** | **GPU** |
| ------------------------------------------------- | ------------- | ------------ | ----------- | ------- |
| Start sandboxes                                   | ✓             | ✓            | ✓           | ✓       |
| Stop sandboxes                                    | ✓             | ✓            | ✓           | ✓       |
| Pause / resume sandboxes                          | ✗             | ✓            | ✓           | ✗       |
| Archive sandboxes                                 | ✓             | ✗            | ✗           | ✗       |
| Fork sandboxes                                    | ✗             | ✓            | ✓           | ✗       |
| Snapshot from sandbox <br />(filesystem only)     | ✓             | ✓            | ✓           | ✓       |
| Snapshot from sandbox <br />(filesystem + memory) | ✗             | ✓            | ✓           | ✗       |

The diagram demonstrates the states and possible transitions between them.

<SandboxDiagram />

<Collapsible title="Sandbox states">
  | **State**         | **Description**                                                                                                                                                     |
  | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Creating          | The sandbox is provisioning and will be ready to use.                                                                                                               |
  | Pulling Snapshot  | The sandbox is pulling a [**snapshot**](/docs/en/snapshots) to provide a base environment.                                                                          |
  | Building Snapshot | The sandbox is building a [**snapshot**](/docs/en/snapshots) to provide a base environment.                                                                         |
  | Pending Build     | The sandbox build is pending and will start shortly.                                                                                                                |
  | Build Failed      | The sandbox build failed and needs to be retried.                                                                                                                   |
  | Starting          | The sandbox is starting and will be ready to use.                                                                                                                   |
  | Started           | The sandbox has started and is ready to use.                                                                                                                        |
  | Stopping          | The sandbox is stopping and will no longer accept requests.                                                                                                         |
  | Stopped           | The sandbox has stopped and is no longer running. Container sandboxes keep their filesystem on the runner. VM sandboxes offload filesystem state to nearby storage. |
  | Pausing           | The VM sandbox is pausing while its filesystem and memory state are preserved.                                                                                      |
  | Paused            | The VM sandbox is paused with filesystem and memory state preserved. State is offloaded to nearby storage.                                                          |
  | Resuming          | The VM sandbox is resuming from a paused state and will be ready to use.                                                                                            |
  | Archiving         | The container sandbox filesystem is being moved to object storage.                                                                                                  |
  | Archived          | The container sandbox filesystem is stored in object storage.                                                                                                       |
  | Restoring         | The sandbox is being restored and will be ready to use shortly.                                                                                                     |
  | Resizing          | The sandbox is being resized to a new set of resources.                                                                                                             |
  | Snapshotting      | The sandbox is creating a [**snapshot**](/docs/en/snapshots) of its filesystem and memory.                                                                          |
  | Forking           | The sandbox is being forked into a new independent sandbox.                                                                                                         |
  | Deleting          | The sandbox is deleting and will be removed.                                                                                                                        |
  | Deleted           | The sandbox has been deleted and no longer exists.                                                                                                                  |
  | Error             | The sandbox is in an error state and needs to be recovered.                                                                                                         |
  | Unknown           | The default sandbox state before it is created.                                                                                                                     |
</Collapsible>

##### State transitions [#state-transitions]

A sandbox can transition between states in response to various actions. The following table lists the initial state, target state, and trigger for the transition.

<Collapsible title="State transitions">
  | **Initial state** | **Target state**  | **Trigger**                                                                       |
  | ----------------- | ----------------- | --------------------------------------------------------------------------------- |
  | Unknown           | Pulling Snapshot  | The base snapshot is being pulled to provide the sandbox environment.             |
  | Unknown           | Building Snapshot | The sandbox uses a declarative image build, which begins building.                |
  | Pending Build     | Building Snapshot | The queued image build starts.                                                    |
  | Building Snapshot | Build Failed      | The image build fails or times out.                                               |
  | Pulling Snapshot  | Creating          | The snapshot is available and the sandbox container is created.                   |
  | Building Snapshot | Creating          | The snapshot finishes building and the sandbox container is created.              |
  | Creating          | Started           | The sandbox container finishes initializing and is running.                       |
  | Stopped           | Starting          | A start is requested and the sandbox boots.                                       |
  | Stopped           | Restoring         | A start is requested and the sandbox is restored from a backup.                   |
  | Archived          | Restoring         | A start is requested and the archived filesystem is restored from object storage. |
  | Restoring         | Started           | The restore completes and the sandbox is running.                                 |
  | Starting          | Started           | The sandbox is running and ready to accept requests.                              |
  | Started           | Stopping          | A stop is requested, or the auto-stop interval is exceeded.                       |
  | Stopping          | Stopped           | The sandbox process exits and its memory state is cleared.                        |
  | Started           | Pausing           | A pause is requested, or the auto-pause interval is exceeded.                     |
  | Pausing           | Paused            | The filesystem and memory state are preserved.                                    |
  | Paused            | Resuming          | A start is requested on a paused sandbox.                                         |
  | Paused            | Stopping          | A stop is requested on a paused sandbox.                                          |
  | Resuming          | Started           | The sandbox resumes from memory and is running.                                   |
  | Stopped           | Archiving         | An archive is requested, or the auto-archive interval is exceeded.                |
  | Archiving         | Archived          | The backup completes and the filesystem is moved to object storage.               |
  | Started           | Resizing          | CPU or memory is increased on a running sandbox.                                  |
  | Stopped           | Resizing          | Resources are changed on a stopped sandbox.                                       |
  | Resizing          | Started           | The running sandbox returns to service after resizing.                            |
  | Resizing          | Stopped           | The stopped sandbox completes resizing.                                           |
  | Started           | Snapshotting      | A snapshot of the filesystem and memory is created.                               |
  | Stopped           | Snapshotting      | A snapshot of the filesystem is created.                                          |
  | Snapshotting      | Started           | The snapshot completes and the sandbox returns to service.                        |
  | Snapshotting      | Stopped           | The snapshot completes and the sandbox remains stopped.                           |
  | Started           | Forking           | The sandbox is forked into a new independent sandbox.                             |
  | Forking           | Started           | The fork completes and the sandbox returns to service.                            |
  | Started           | Deleting          | A delete is requested, or the auto-delete interval is exceeded.                   |
  | Stopped           | Deleting          | A delete is requested.                                                            |
  | Archived          | Deleted           | An archived sandbox is deleted directly without being restored.                   |
  | Deleting          | Deleted           | The sandbox is removed and its resources are released.                            |
  | Started           | Error             | An operation fails or times out.                                                  |
  | Error             | Restoring         | A recover is requested for a recoverable error and the sandbox is restored.       |
  | Error             | Archiving         | An errored sandbox with a completed backup is archived to preserve its state.     |
</Collapsible>

## Automated lifecycle management [#automated-lifecycle-management]

Sandboxes can be managed automatically based on user-defined deadlines. Inactivity and stopped-time intervals stop, pause, archive, or delete a sandbox when it is idle. Wall-clock TTL destroys a sandbox after a fixed deadline regardless of state.

* **[Auto-stop interval](#auto-stop-interval)**: stop a sandbox after a specified period of inactivity
* **[Auto-pause interval](#auto-pause-interval)**: pause a VM sandbox after a specified period of inactivity
* **[Auto-archive interval](#auto-archive-interval)**: archive a sandbox after a specified period of inactivity
* **[Auto-delete interval](#auto-delete-interval)**: delete a sandbox after a specified period of inactivity
* **[Wall-clock TTL](#wall-clock-ttl)**: destroy a sandbox after a fixed wall-clock deadline, regardless of state
* **[Update sandbox last activity](#update-sandbox-last-activity)**: signal activity to reset the inactivity timer
* **[Running indefinitely](#running-indefinitely)**: run a sandbox indefinitely

### Auto-stop interval [#auto-stop-interval]

The auto-stop interval sets the amount of time after which a running sandbox is automatically stopped. The auto-stop triggers even if there are internal processes running in the sandbox.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Set &#x2A;*`auto-stop`** interval to the desired value in minutes
   * **`0`**: disables the auto-stop functionality, allowing the sandbox to run indefinitely
   * if not set, the default interval of 15 minutes is used
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(
        snapshot="my-snapshot",
        # Disables the auto-stop feature - default is 15 minutes
        auto_stop_interval=0,
    ))
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    const sandbox = await daytona.create({
      snapshot: 'my-snapshot',
      // Disables the auto-stop feature - default is 15 minutes
      autoStopInterval: 0,
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        snapshot: 'my-snapshot',
        # Disables the auto-stop feature - default is 15 minutes
        auto_stop_interval: 0
      )
    )
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    // Create a sandbox with auto-stop disabled
    autoStopInterval := 0
    params := types.SnapshotParams{
        Snapshot: "my-snapshot",
        SandboxBaseParams: types.SandboxBaseParams{
            AutoStopInterval: &autoStopInterval,
        },
    }
    sandbox, err := client.Create(ctx, params)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setSnapshot("my-snapshot");
                // Disables the auto-stop feature - default is 15 minutes
                params.setAutoStopInterval(0);
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autostop/{interval}' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

The system differentiates between "internal processes" and "active user interaction". Merely having a script or background task running is not sufficient to keep the sandbox alive.

##### What resets the timer [#what-resets-the-timer]

The inactivity timer resets only for specific external interactions:

* Updates to [sandbox lifecycle states](#sandbox-lifecycle)
* Network requests through [sandbox previews](/docs/en/preview)
* Active [SSH connections](/docs/en/ssh-access)
* API requests to the [Daytona Toolbox SDK](/docs/en/tools/api/#daytona-toolbox)

##### What does not reset the timer [#what-does-not-reset-the-timer]

The following do not reset the timer:

* SDK requests that are not toolbox actions
* Background scripts (e.g., `npm run dev` run as a fire-and-forget command)
* Long-running tasks without external interaction
* Processes that don't involve active monitoring

If you run a long-running task like LLM inference that takes more than 15 minutes to complete without any external interaction, the sandbox may auto-stop mid-process because the process itself doesn't count as "activity", therefore the timer is not reset.

### Auto-pause interval [#auto-pause-interval]

The auto-pause interval sets the amount of time after which an idle VM sandbox is automatically [paused](#pause--resume-sandboxes). Auto-pause applies only to [VM sandboxes](#vm-sandboxes) and is mutually exclusive with the [auto-stop interval](#auto-stop-interval): at most one of the two intervals may be non-zero. Ephemeral sandboxes cannot have auto-pause enabled.

The interval is set in minutes:

* **`0`**: disables the auto-pause functionality
* if neither auto-pause nor auto-stop is set, non-ephemeral sandbox classes that support pausing default to an auto-pause interval of 60 minutes with auto-stop disabled

The sandbox pauses after no new events occur for the specified interval. Events include sandbox state changes and interactions with the sandbox through the SDK. Interactions through [sandbox previews](/docs/en/preview) do not reset the timer.

<Tabs syncKey="sandbox-class">
  <TabItem label="Container" icon="seti:docker">
    Auto-pause is not supported for container sandboxes. Use <u>[**auto-stop**](#auto-stop-interval)</u> to stop a container sandbox after a period of inactivity.
  </TabItem>

  <TabItem label="Linux VM" icon="linux">
    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click <Button>Create Sandbox</Button>
    3. Select a Linux VM snapshot
    4. Set &#x2A;*`auto-pause`** interval to the desired value in minutes
       * **`0`**: disables the auto-pause functionality
       * if neither auto-pause nor auto-stop is set, the default interval of 60 minutes is used with auto-stop disabled
    5. Click <Button>Create</Button>

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox = daytona.create(CreateSandboxFromSnapshotParams(
            snapshot="daytona-vm-small",
            # Auto-pause after 1 hour of inactivity
            auto_pause_interval=60,
        ))

        # Update the auto-pause interval on an existing sandbox
        sandbox.set_auto_pause_interval(60)

        # Disable auto-pause
        sandbox.set_auto_pause_interval(0)
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        const sandbox = await daytona.create({
          snapshot: 'daytona-vm-small',
          // Auto-pause after 1 hour of inactivity
          autoPauseInterval: 60,
        })

        // Update the auto-pause interval on an existing sandbox
        await sandbox.setAutoPauseInterval(60)

        // Disable auto-pause
        await sandbox.setAutoPauseInterval(0)
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox = daytona.create(
          Daytona::CreateSandboxFromSnapshotParams.new(
            snapshot: 'daytona-vm-small',
            # Auto-pause after 1 hour of inactivity
            auto_pause_interval: 60
          )
        )

        # Update the auto-pause interval on an existing sandbox
        sandbox.auto_pause_interval = 60

        # Disable auto-pause
        sandbox.auto_pause_interval = 0
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        // Auto-pause after 1 hour of inactivity
        autoPauseInterval := 60
        params := types.SnapshotParams{
            Snapshot: "daytona-vm-small",
            SandboxBaseParams: types.SandboxBaseParams{
                AutoPauseInterval: &autoPauseInterval,
            },
        }
        sandbox, err := client.Create(ctx, params)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

        public class App {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                    params.setSnapshot("daytona-vm-small");
                    // Auto-pause after 1 hour of inactivity
                    params.setAutoPauseInterval(60);
                    Sandbox sandbox = daytona.create(params);

                    // Update the auto-pause interval on an existing sandbox
                    sandbox.setAutoPauseInterval(60);

                    // Disable auto-pause
                    sandbox.setAutoPauseInterval(0);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autopause/{interval}' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="Windows" icon="seti:windows">
    1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
    2. Click <Button>Create Sandbox</Button>
    3. Select a Windows snapshot
    4. Set &#x2A;*`auto-pause`** interval to the desired value in minutes
       * **`0`**: disables the auto-pause functionality
       * if neither auto-pause nor auto-stop is set, the default interval of 60 minutes is used with auto-stop disabled
    5. Click <Button>Create</Button>

    <Tabs syncKey="language">
      <TabItem label="Python" icon="seti:python">
        ```python
        sandbox = daytona.create(CreateSandboxFromSnapshotParams(
            snapshot="windows-small",
            # Auto-pause after 1 hour of inactivity
            auto_pause_interval=60,
        ))

        # Update the auto-pause interval on an existing sandbox
        sandbox.set_auto_pause_interval(60)

        # Disable auto-pause
        sandbox.set_auto_pause_interval(0)
        ```
      </TabItem>

      <TabItem label="TypeScript" icon="seti:typescript">
        ```typescript
        const sandbox = await daytona.create({
          snapshot: 'windows-small',
          // Auto-pause after 1 hour of inactivity
          autoPauseInterval: 60,
        })

        // Update the auto-pause interval on an existing sandbox
        await sandbox.setAutoPauseInterval(60)

        // Disable auto-pause
        await sandbox.setAutoPauseInterval(0)
        ```
      </TabItem>

      <TabItem label="Ruby" icon="seti:ruby">
        ```ruby
        sandbox = daytona.create(
          Daytona::CreateSandboxFromSnapshotParams.new(
            snapshot: 'windows-small',
            # Auto-pause after 1 hour of inactivity
            auto_pause_interval: 60
          )
        )

        # Update the auto-pause interval on an existing sandbox
        sandbox.auto_pause_interval = 60

        # Disable auto-pause
        sandbox.auto_pause_interval = 0
        ```
      </TabItem>

      <TabItem label="Go" icon="seti:go">
        ```go
        // Auto-pause after 1 hour of inactivity
        autoPauseInterval := 60
        params := types.SnapshotParams{
            Snapshot: "windows-small",
            SandboxBaseParams: types.SandboxBaseParams{
                AutoPauseInterval: &autoPauseInterval,
            },
        }
        sandbox, err := client.Create(ctx, params)
        ```
      </TabItem>

      <TabItem label="Java" icon="seti:java">
        ```java
        import io.daytona.sdk.Daytona;
        import io.daytona.sdk.Sandbox;
        import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

        public class App {
            public static void main(String[] args) {
                try (Daytona daytona = new Daytona()) {
                    CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                    params.setSnapshot("windows-small");
                    // Auto-pause after 1 hour of inactivity
                    params.setAutoPauseInterval(60);
                    Sandbox sandbox = daytona.create(params);

                    // Update the auto-pause interval on an existing sandbox
                    sandbox.setAutoPauseInterval(60);

                    // Disable auto-pause
                    sandbox.setAutoPauseInterval(0);
                }
            }
        }
        ```
      </TabItem>

      <TabItem label="API" icon="seti:json">
        ```bash
        curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autopause/{interval}' \
          --request POST \
          --header 'Authorization: Bearer YOUR_API_KEY'
        ```
      </TabItem>
    </Tabs>
  </TabItem>

  <TabItem label="GPU" icon="seti:cu">
    Auto-pause is not supported for GPU sandboxes. GPU sandboxes are ephemeral and cannot have auto-pause enabled.
  </TabItem>
</Tabs>

### Auto-archive interval [#auto-archive-interval]

The auto-archive interval sets the amount of time after which a continuously stopped sandbox is automatically archived. Auto-archive applies only to container sandboxes. VM sandboxes are excluded.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Set &#x2A;*`auto-archive`** interval to the desired value in minutes
   * **`0`**: the maximum interval of 30 days is used
   * if not set, the default interval of 7 days is used
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(
        snapshot="my-snapshot",
        # Auto-archive after a sandbox has been stopped for 1 hour
        auto_archive_interval=60,
    ))
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    const sandbox = await daytona.create({
      snapshot: 'my-snapshot',
      // Auto-archive after a sandbox has been stopped for 1 hour
      autoArchiveInterval: 60,
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        snapshot: 'my-snapshot',
        # Auto-archive after a sandbox has been stopped for 1 hour
        auto_archive_interval: 60
      )
    )
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    // Create a sandbox with auto-archive after 1 hour
    autoArchiveInterval := 60
    params := types.SnapshotParams{
        Snapshot: "my-snapshot",
        SandboxBaseParams: types.SandboxBaseParams{
            AutoArchiveInterval: &autoArchiveInterval,
        },
    }
    sandbox, err := client.Create(ctx, params)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setSnapshot("my-snapshot");
                // Auto-archive after a sandbox has been stopped for 1 hour
                params.setAutoArchiveInterval(60);
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autoarchive/{interval}' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

### Auto-delete interval [#auto-delete-interval]

The auto-delete interval sets the amount of time after which a continuously stopped sandbox is automatically deleted.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Set &#x2A;*`auto-delete`** to the desired value in minutes
   * `-1`: disables the auto-delete functionality
   * `0`: the sandbox is deleted immediately after it is stopped
   * if not set, the sandbox is not deleted automatically
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(
        snapshot="my-snapshot",
        # Auto-delete after a sandbox has been stopped for 1 hour
        auto_delete_interval=60,
    ))

    # Delete the sandbox immediately after it has been stopped
    sandbox.set_auto_delete_interval(0)

    # Disable auto-deletion
    sandbox.set_auto_delete_interval(-1)
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    const sandbox = await daytona.create({
      snapshot: 'my-snapshot',
      // Auto-delete after a sandbox has been stopped for 1 hour
      autoDeleteInterval: 60,
    })

    // Delete the sandbox immediately after it has been stopped
    await sandbox.setAutoDeleteInterval(0)

    // Disable auto-deletion
    await sandbox.setAutoDeleteInterval(-1)
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        snapshot: 'my-snapshot',
        # Auto-delete after a sandbox has been stopped for 1 hour
        auto_delete_interval: 60
      )
    )

    # Delete the sandbox immediately after it has been stopped
    sandbox.auto_delete_interval = 0

    # Disable auto-deletion
    sandbox.auto_delete_interval = -1
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    // Create a sandbox with auto-delete after 1 hour
    autoDeleteInterval := 60
    params := types.SnapshotParams{
        Snapshot: "my-snapshot",
        SandboxBaseParams: types.SandboxBaseParams{
            AutoDeleteInterval: &autoDeleteInterval,
        },
    }
    sandbox, err := client.Create(ctx, params)

    // Delete the sandbox immediately after it has been stopped
    zeroInterval := 0
    err = sandbox.SetAutoDeleteInterval(ctx, &zeroInterval)

    // Disable auto-deletion
    disableInterval := -1
    err = sandbox.SetAutoDeleteInterval(ctx, &disableInterval)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setSnapshot("my-snapshot");
                // Auto-delete after a sandbox has been stopped for 1 hour
                params.setAutoDeleteInterval(60);
                Sandbox sandbox = daytona.create(params);

                // Delete the sandbox immediately after it has been stopped
                sandbox.setAutoDeleteInterval(0);

                // Disable auto-deletion
                sandbox.setAutoDeleteInterval(-1);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autodelete/{interval}' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

### Wall-clock TTL [#wall-clock-ttl]

The wall-clock TTL (time-to-live) sets a hard upper bound on how long a sandbox may exist. Unlike the [auto-delete interval](#auto-delete-interval), which counts time only while the sandbox is stopped, TTL runs as wall-clock time from creation (or from the moment you last set it) and destroys the sandbox in any state: started, stopped, paused, or archived.

Set `ttl_minutes` when creating a sandbox, or update it later. The value is in minutes:

* **`0`**: disables the TTL
* if not set, the sandbox has no TTL deadline

Calling `set_ttl` after creation resets the deadline from the current moment. Use wall-clock TTL for agent sessions, CI jobs, and any sandbox that must not outlive a fixed deadline.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(
        snapshot="my-snapshot",
        # Destroy the sandbox 2 hours after creation, regardless of state
        ttl_minutes=120,
    ))

    # Reset the deadline to 1 hour from now
    sandbox.set_ttl(60)

    # Disable the TTL
    sandbox.set_ttl(0)
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    const sandbox = await daytona.create({
      snapshot: 'my-snapshot',
      // Destroy the sandbox 2 hours after creation, regardless of state
      ttlMinutes: 120,
    })

    // Reset the deadline to 1 hour from now
    await sandbox.setTtl(60)

    // Disable the TTL
    await sandbox.setTtl(0)
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        snapshot: 'my-snapshot',
        # Destroy the sandbox 2 hours after creation, regardless of state
        ttl_minutes: 120
      )
    )

    # Reset the deadline to 1 hour from now
    sandbox.ttl_minutes = 60

    # Disable the TTL
    sandbox.ttl_minutes = 0
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    // Destroy the sandbox 2 hours after creation, regardless of state
    ttlMinutes := 120
    params := types.SnapshotParams{
        Snapshot: "my-snapshot",
        SandboxBaseParams: types.SandboxBaseParams{
            TtlMinutes: &ttlMinutes,
        },
    }
    sandbox, err := client.Create(ctx, params)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setSnapshot("my-snapshot");
                // Destroy the sandbox 2 hours after creation, regardless of state
                params.setTtlMinutes(120);
                Sandbox sandbox = daytona.create(params);

                // Reset the deadline to 1 hour from now
                sandbox.setTtl(60);

                // Disable the TTL
                sandbox.setTtl(0);
            }
        }
    }
    ```
  </TabItem>

  <TabItem label="CLI" icon="seti:shell">
    ```bash
    # Destroy the sandbox 2 hours after creation, regardless of state
    daytona create --ttl 120
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    # Create with a 2-hour wall-clock TTL
    curl 'https://app.daytona.io/api/sandbox' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer YOUR_API_KEY' \
      --data '{
      "snapshot": "my-snapshot",
      "ttlMinutes": 120
    }'

    # Reset the deadline to 1 hour from now
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/ttl/60' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'

    # Disable the TTL
    curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/ttl/0' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

### Update sandbox last activity [#update-sandbox-last-activity]

Update a sandbox's last activity timestamp.

This updates the sandbox's recorded activity time without changing its runtime state. It is useful when your workflow is driven by external systems or background orchestration that may not reset inactivity tracking.

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox.refresh_activity()
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    await sandbox.refreshActivity()
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox.refresh_activity
    ```
  </TabItem>

  <TabItem label="API" icon="seti:json">
    ```bash
    curl 'https://app.daytona.io/api/sandbox/{sandboxId}/last-activity' \
      --request POST \
      --header 'Authorization: Bearer YOUR_API_KEY'
    ```
  </TabItem>
</Tabs>

### Running indefinitely [#running-indefinitely]

Run sandboxes indefinitely.

By default, Daytona sandboxes auto-stop after 15 minutes of inactivity. To keep a sandbox running without interruption from inactivity, set the auto-stop interval to `0` when creating a new sandbox. Disabling auto-stop does not disable [wall-clock TTL](#wall-clock-ttl): if `ttl_minutes` is set, the sandbox is still destroyed when that deadline elapses.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click <Button>Create Sandbox</Button>
3. Set &#x2A;*`auto-stop`*&#x2A; to &#x2A;*`0`**
4. Click <Button>Create</Button>

<Tabs syncKey="language">
  <TabItem label="Python" icon="seti:python">
    ```python
    sandbox = daytona.create(CreateSandboxFromSnapshotParams(
        snapshot="my_awesome_snapshot",
        # Disables the auto-stop feature - default is 15 minutes
        auto_stop_interval=0,
    ))
    ```
  </TabItem>

  <TabItem label="TypeScript" icon="seti:typescript">
    ```typescript
    const sandbox = await daytona.create({
      snapshot: 'my_awesome_snapshot',
      // Disables the auto-stop feature - default is 15 minutes
      autoStopInterval: 0,
    })
    ```
  </TabItem>

  <TabItem label="Ruby" icon="seti:ruby">
    ```ruby
    sandbox = daytona.create(
      Daytona::CreateSandboxFromSnapshotParams.new(
        snapshot: 'my_awesome_snapshot',
        # Disables the auto-stop feature - default is 15 minutes
        auto_stop_interval: 0
      )
    )
    ```
  </TabItem>

  <TabItem label="Go" icon="seti:go">
    ```go
    // Disables the auto-stop feature - default is 15 minutes
    autoStopInterval := 0
    params := types.SnapshotParams{
        Snapshot: "my_awesome_snapshot",
        SandboxBaseParams: types.SandboxBaseParams{
            AutoStopInterval: &autoStopInterval,
        },
    }
    sandbox, err := client.Create(ctx, params)
    ```
  </TabItem>

  <TabItem label="Java" icon="seti:java">
    ```java
    import io.daytona.sdk.Daytona;
    import io.daytona.sdk.Sandbox;
    import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

    public class App {
        public static void main(String[] args) {
            try (Daytona daytona = new Daytona()) {
                CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();
                params.setSnapshot("my_awesome_snapshot");
                // Disables the auto-stop feature - default is 15 minutes
                params.setAutoStopInterval(0);
                Sandbox sandbox = daytona.create(params);
            }
        }
    }
    ```
  </TabItem>
</Tabs>
