# Linux Sandboxes

Copy for LLM[View as Markdown](/content/docs/en/linux-sandboxes.md)Open

Daytona provides **Linux sandboxes** as the default sandbox for AI agents. A Linux sandbox is an isolated runtime environment you manage programmatically to run code. Each sandbox has a dedicated filesystem, network stack, and allocated vCPU, RAM, and disk. Agents and developers can install packages, run servers, compile code, and manage processes.

Linux sandboxes run as **containers** or as **Linux virtual machines (VMs)**. The snapshot sets the sandbox class, and both classes use the same SDKs, CLI, and API. Linux sandboxes start from a snapshot or a Docker image, keep their filesystem across stop and start, and are deleted when a timeout elapses or on request.

| **Term** | **Description** |
| --- | --- |
| **Sandbox** | An isolated Linux environment created on demand to run code. |
| **Container** | A sandbox that runs as a Linux container and shares the kernel of the host. The default sandbox class. |
| **Linux VM** | A sandbox that runs as a virtual machine with its own Linux kernel. The hardware enforces the boundary between sandboxes. |
| **Sandbox class** | The runtime of a Linux sandbox: container or Linux VM. The snapshot sets the class. |
| **Image** | A packaged filesystem that defines the software a sandbox starts with. Container sandboxes can start from a Docker image. |
| **Snapshot** | A pre-configured template that new sandboxes start from. |
| **Toolbox** | The Daytona daemon inside the sandbox that serves file, Git, and process requests. |

## [\#](/content/docs/en/linux-sandboxes/\#use-cases/index.html) Use cases

[Section titled “Use cases”](/content/docs/en/linux-sandboxes/#use-cases/index.html)

Linux sandboxes are used wherever code must run in a real environment, but you cannot trust the code or you cannot afford for it to affect anything else.

- **Code execution for AI agents**: an agent writes code, runs it in a sandbox, reads the output, and decides what to do next. The sandbox gives the agent a real shell and filesystem while keeping its actions away from your infrastructure.
- **Coding agents**: an agent clones a repository, installs dependencies, edits files, runs the test suite, and pushes a branch, all inside one sandbox.
- **Reinforcement learning (RL) and evaluation**: each episode or test case gets a clean, identical machine created from a shared snapshot, so results do not depend on leftover state and each environment stays cheap.
- **Untrusted user code**: online coding platforms, grading systems, code interpreters, and plugin hosts run code submitted by users or generated by a model without exposing other users or the service.
- **Computer-use agents**: an agent operates a graphical desktop, a browser, or desktop applications through screenshots and input events.
- **Development environments**: a developer gets a preconfigured machine from an image, connects over SSH or from an editor, and previews web applications through a URL.
- **Long-lived and branching agent sessions**: a Linux VM sandbox pauses when the agent goes idle and resumes with its processes and memory intact, and is forked to try several approaches from the same point.

## [\#](/content/docs/en/linux-sandboxes/\#create-a-linux-sandbox/index.html) Create a Linux sandbox

[Section titled “Create a Linux sandbox”](/content/docs/en/linux-sandboxes/#create-a-linux-sandbox/index.html)

Create a sandbox.

- [Default](/content/docs/en/linux-sandboxes/#tab-panel-819/index.html)
- [Custom](/content/docs/en/linux-sandboxes/#tab-panel-820/index.html)

Create a container sandbox. A sandbox created without a snapshot uses the Daytona default snapshot. To pick a size, set one of the default container snapshots.

| **Snapshot** | **vCPU** | **Memory** | **Storage** | **Sandbox Class** |
| --- | --- | --- | --- | --- |
| **`daytona-small`** | 1 | 1GiB | 3GiB | Container |
| **`daytona-medium`** | 2 | 4GiB | 8GiB | Container |
| **`daytona-large`** | 4 | 8GiB | 10GiB | Container |
| **`daytona-vm-small`** | 1 | 1GiB | 3GiB | Linux VM |
| **`daytona-vm-medium`** | 2 | 4GiB | 8GiB | Linux VM |
| **`daytona-vm-large`** | 4 | 8GiB | 10GiB | Linux VM |

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

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-690/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-691/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-692/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-693/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-694/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-695/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-696/index.html)

```
from daytona import Daytona

daytona = Daytona()

sandbox = daytona.create()
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create()
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create
```

```
package main

import (

"context"

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

)

func main() {

client, _ := daytona.NewClient()

ctx := context.Background()

_, _ = client.Create(ctx, nil)

}
```

```
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();

}

}

}
```

```
daytona create
```

```
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{}'
```

Create a Linux sandbox from your own snapshot. Create the snapshot from any publicly accessible image, then create sandboxes from it.

1. Go to [Daytona Snapshots ↗](https://app.daytona.io/dashboard/snapshots)
2. Click Create Snapshot
3. Enter the Snapshot Name, for example **`my-snapshot`**
4. Enter the Image, for example **`python:3.12`**
5. Click Create
6. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
7. Click Create Sandbox
8. Select the Snapshot **`my-snapshot`**
9. Click Create

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-697/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-698/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-699/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-700/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-701/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-702/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-703/index.html)

```
from daytona import CreateSandboxFromSnapshotParams, CreateSnapshotParams, Daytona

daytona = Daytona()

# Create a snapshot from an image

daytona.snapshot.create(

CreateSnapshotParams(

name="my-snapshot",

image="python:3.12",

),

)

# Create a sandbox from the snapshot

sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-snapshot"))
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

// Create a snapshot from an image

await daytona.snapshot.create({

name: 'my-snapshot',

image: 'python:3.12',

})

// Create a sandbox from the snapshot

const sandbox = await daytona.create({ snapshot: 'my-snapshot' })
```

```
require 'daytona'

daytona = Daytona::Daytona.new

# Create a snapshot from an image

daytona.snapshot.create(

Daytona::CreateSnapshotParams.new(

name: 'my-snapshot',

image: 'python:3.12'

)

)

# Create a sandbox from the snapshot

sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'my-snapshot'))
```

```
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()

// Create a snapshot from an image

_, logCh, _ := client.Snapshot.Create(ctx, &types.CreateSnapshotParams{

Name:  "my-snapshot",

Image: "python:3.12",

})

for range logCh {

}

// Create a sandbox from the snapshot

_, _ = client.Create(ctx, types.SnapshotParams{Snapshot: "my-snapshot"})

}
```

```
import io.daytona.sdk.Daytona;

import io.daytona.sdk.Sandbox;

import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

import io.daytona.sdk.model.Snapshot;

public class App {

public static void main(String[] args) {

try (Daytona daytona = new Daytona()) {

// Create a snapshot from an image

Snapshot snapshot = daytona.snapshot().create("my-snapshot", "python:3.12");

// Create a sandbox from the snapshot

CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();

params.setSnapshot("my-snapshot");

Sandbox sandbox = daytona.create(params);

}

}

}
```

```
daytona snapshot create my-snapshot --image python:3.12

daytona create --snapshot my-snapshot
```

```
# Create a snapshot from an image

curl 'https://app.daytona.io/api/snapshots' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"name": "my-snapshot",

"imageName": "python:3.12"

}'

# Create a 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-snapshot"}'
```

## [\#](/content/docs/en/linux-sandboxes/\#create-a-linux-vm-sandbox/index.html) Create a Linux VM sandbox

[Section titled “Create a Linux VM sandbox”](/content/docs/en/linux-sandboxes/#create-a-linux-vm-sandbox/index.html)

Create a Linux VM sandbox.

- [Default](/content/docs/en/linux-sandboxes/#tab-panel-821/index.html)
- [Custom](/content/docs/en/linux-sandboxes/#tab-panel-822/index.html)

Create a Linux VM sandbox from a default snapshot.

| **Snapshot** | **vCPU** | **Memory** | **Storage** |
| --- | --- | --- | --- |
| **`daytona-vm-small`** | 1 | 1GiB | 3GiB |
| **`daytona-vm-medium`** | 2 | 4GiB | 8GiB |
| **`daytona-vm-large`** | 4 | 8GiB | 10GiB |

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click Create Sandbox
3. Select a VM Snapshot: **`daytona-vm-small`**, **`daytona-vm-medium`**, or **`daytona-vm-large`**
4. Click Create

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-704/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-705/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-706/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-707/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-708/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-709/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-710/index.html)

```
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="daytona-vm-small"))
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({ snapshot: 'daytona-vm-small' })
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'daytona-vm-small')

)
```

```
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.SnapshotParams{

Snapshot: "daytona-vm-small",

})

}
```

```
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);

}

}

}
```

```
daytona create --snapshot daytona-vm-small
```

```
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"

}'
```

Create a Linux VM sandbox.

01. Go to [Daytona Snapshots ↗](https://app.daytona.io/dashboard/snapshots)
02. Click Create Snapshot
03. Enter the Snapshot Name, for example **`my-vm-snapshot`**
04. Enter the Image, for example **`ubuntu:22.04`**
05. Select Sandbox Class: **`LINUX_VM`**
06. Click Create
07. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
08. Click Create Sandbox
09. Select the VM Snapshot, for example **`my-vm-snapshot`**
10. Click Create

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-711/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-712/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-713/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-714/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-715/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-716/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-717/index.html)

```
from daytona import (

Daytona,

CreateSnapshotParams,

CreateSandboxFromSnapshotParams,

SandboxClass,

)

daytona = Daytona()

# Create a Linux VM snapshot

daytona.snapshot.create(

CreateSnapshotParams(

name="my-vm-snapshot",

image="ubuntu:22.04",

sandbox_class=SandboxClass.LINUX_VM,

)

)

# Create a Linux VM sandbox from the snapshot

sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-vm-snapshot"))
```

```
import { Daytona, SandboxClass } from '@daytona/sdk'

const daytona = new Daytona()

// Create a Linux VM snapshot

await daytona.snapshot.create({

name: 'my-vm-snapshot',

image: 'ubuntu:22.04',

sandboxClass: SandboxClass.LINUX_VM,

})

// Create a Linux VM sandbox from the snapshot

const sandbox = await daytona.create({ snapshot: 'my-vm-snapshot' })
```

```
require 'daytona'

daytona = Daytona::Daytona.new

# Create a Linux VM snapshot

daytona.snapshot.create(

Daytona::CreateSnapshotParams.new(

name: 'my-vm-snapshot',

image: 'ubuntu:22.04',

sandbox_class: DaytonaApiClient::SandboxClass::LINUX_VM

)

)

# Create a Linux VM sandbox from the snapshot

sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'my-vm-snapshot'))
```

```
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()

// Create a Linux VM snapshot

sandboxClass := types.SandboxClassLinuxVM

_, logCh, _ := client.Snapshot.Create(ctx, &types.CreateSnapshotParams{

Name:         "my-vm-snapshot",

Image:        "ubuntu:22.04",

SandboxClass: &sandboxClass,

})

for range logCh {

}

// Create a Linux VM sandbox from the snapshot

_, _ = client.Create(ctx, types.SnapshotParams{

Snapshot: "my-vm-snapshot",

})

}
```

```
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()) {

// Create a Linux VM snapshot

daytona.snapshot().create("my-vm-snapshot", "ubuntu:22.04", SandboxClass.LINUX_VM);

// Create a Linux VM sandbox from the snapshot

CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();

params.setSnapshot("my-vm-snapshot");

Sandbox sandbox = daytona.create(params);

}

}

}
```

```
# Create a Linux VM snapshot

daytona snapshot create my-vm-snapshot --image ubuntu:22.04 --sandbox-class linux-vm

# Create a Linux VM sandbox from the snapshot

daytona create --snapshot my-vm-snapshot
```

```
# Create a Linux VM snapshot

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"

}'

# Create a Linux 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"

}'
```

## [\#](/content/docs/en/linux-sandboxes/\#nested-virtualization/index.html) Nested virtualization

[Section titled “Nested virtualization”](/content/docs/en/linux-sandboxes/#nested-virtualization/index.html)

Daytona provides nested virtualization for Linux VM sandboxes. Nested virtualization exposes KVM (`/dev/kvm`) inside the guest, so the sandbox can run its own virtual machines with hardware acceleration.

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-718/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-719/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-720/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-721/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-722/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-723/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-724/index.html)

```
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromSnapshotParams(

snapshot="daytona-vm-small",

kvm=True,

)

)
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({

snapshot: 'daytona-vm-small',

kvm: true,

})
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'daytona-vm-small',

kvm: true

)

)
```

```
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{

SandboxBaseParams: types.SandboxBaseParams{

Kvm: true,

},

Snapshot: "daytona-vm-small",

}

_, _ = client.Create(ctx, params)

}
```

```
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");

params.setKvm(true);

Sandbox sandbox = daytona.create(params);

}

}

}
```

```
daytona create --snapshot daytona-vm-small --kvm
```

```
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",

"kvm": true

}'
```

## [\#](/content/docs/en/linux-sandboxes/\#filesystem-snapshot/index.html) Filesystem snapshot

[Section titled “Filesystem snapshot”](/content/docs/en/linux-sandboxes/#filesystem-snapshot/index.html)

A filesystem snapshot, also called a cold snapshot, saves the filesystem of a stopped Linux sandbox. Both sandbox classes support filesystem snapshots. A snapshot without the include memory option is a filesystem snapshot.

- [Container](/content/docs/en/linux-sandboxes/#tab-panel-810/index.html)
- [Linux VM](/content/docs/en/linux-sandboxes/#tab-panel-811/index.html)

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-725/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-726/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-727/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-728/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-729/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-730/index.html)

```
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create()

# Write a file to the filesystem

sandbox.fs.upload_file(b"done", "setup.log")

# A filesystem snapshot requires a stopped sandbox

sandbox.stop()

sandbox.create_snapshot("my-snapshot")

# A sandbox created from the snapshot starts with the same filesystem

new_sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-snapshot"))

content = new_sandbox.fs.download_file("setup.log")

print(content.decode())  # done
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create()

// Write a file to the filesystem

await sandbox.fs.uploadFile(Buffer.from('done'), 'setup.log')

// A filesystem snapshot requires a stopped sandbox

await sandbox.stop()

await sandbox.createSnapshot('my-snapshot')

// A sandbox created from the snapshot starts with the same filesystem

const newSandbox = await daytona.create({ snapshot: 'my-snapshot' })

const content = await newSandbox.fs.downloadFile('setup.log')

console.log(content.toString()) // done
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create

# Write a file to the filesystem

sandbox.fs.upload_file('done', 'setup.log')

# A filesystem snapshot requires a stopped sandbox

sandbox.stop

sandbox.create_snapshot(name: 'my-snapshot')

# A sandbox created from the snapshot starts with the same filesystem

new_sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'my-snapshot'))

content = new_sandbox.fs.download_file('setup.log')

puts content # done
```

```
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()

sandbox, err := client.Create(ctx, types.SnapshotParams{})

if err != nil {

panic(err)

}

// Write a file to the filesystem

if err := sandbox.FileSystem.UploadFile(ctx, []byte("done"), "setup.log"); err != nil {

panic(err)

}

// A filesystem snapshot requires a stopped sandbox

if err := sandbox.Stop(ctx); err != nil {

panic(err)

}

if err := sandbox.CreateSnapshot(ctx, "my-snapshot"); err != nil {

panic(err)

}

// A sandbox created from the snapshot starts with the same filesystem

newSandbox, err := client.Create(ctx, types.SnapshotParams{Snapshot: "my-snapshot"})

if err != nil {

panic(err)

}

content, err := newSandbox.FileSystem.DownloadFile(ctx, "setup.log", nil)

if err != nil {

panic(err)

}

fmt.Println(string(content)) // done

}
```

```
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()) {

Sandbox sandbox = daytona.create();

// Write a file to the filesystem

sandbox.fs.uploadFile("done".getBytes(), "setup.log");

// A filesystem snapshot requires a stopped sandbox

sandbox.stop();

sandbox.createSnapshot("my-snapshot");

// A sandbox created from the snapshot starts with the same filesystem

CreateSandboxFromSnapshotParams fromSnapshot = new CreateSandboxFromSnapshotParams();

fromSnapshot.setSnapshot("my-snapshot");

Sandbox newSandbox = daytona.create(fromSnapshot);

byte[] content = newSandbox.fs.downloadFile("setup.log");

System.out.println(new String(content)); // done

}

}

}
```

```
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{}'

# Write a file to the filesystem

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/files/upload-v2?path=setup.log' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY' \

--form 'file=@setup.log'

# A filesystem snapshot requires a stopped sandbox

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/snapshot' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"name": "my-snapshot",

"includeMemory": false

}'

# A sandbox created from the snapshot starts with the same filesystem

curl 'https://app.daytona.io/api/sandbox' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{"snapshot": "my-snapshot"}'

curl 'https://proxy.app.daytona.io/toolbox/{newSandboxId}/files/download?path=setup.log' \

--header 'Authorization: Bearer YOUR_API_KEY'
```

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-731/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-732/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-733/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-734/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-735/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-736/index.html)

```
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="daytona-vm-small"))

# Write a file to the filesystem

sandbox.fs.upload_file(b"done", "setup.log")

# A filesystem snapshot requires a stopped sandbox

sandbox.stop()

sandbox.create_snapshot("my-vm-snapshot")

# A sandbox created from the snapshot starts with the same filesystem

new_sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="my-vm-snapshot"))

content = new_sandbox.fs.download_file("setup.log")

print(content.decode())  # done
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({ snapshot: 'daytona-vm-small' })

// Write a file to the filesystem

await sandbox.fs.uploadFile(Buffer.from('done'), 'setup.log')

// A filesystem snapshot requires a stopped sandbox

await sandbox.stop()

await sandbox.createSnapshot('my-vm-snapshot')

// A sandbox created from the snapshot starts with the same filesystem

const newSandbox = await daytona.create({ snapshot: 'my-vm-snapshot' })

const content = await newSandbox.fs.downloadFile('setup.log')

console.log(content.toString()) // done
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'daytona-vm-small'))

# Write a file to the filesystem

sandbox.fs.upload_file('done', 'setup.log')

# A filesystem snapshot requires a stopped sandbox

sandbox.stop

sandbox.create_snapshot(name: 'my-vm-snapshot')

# A sandbox created from the snapshot starts with the same filesystem

new_sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'my-vm-snapshot'))

content = new_sandbox.fs.download_file('setup.log')

puts content # done
```

```
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()

sandbox, err := client.Create(ctx, types.SnapshotParams{Snapshot: "daytona-vm-small"})

if err != nil {

panic(err)

}

// Write a file to the filesystem

if err := sandbox.FileSystem.UploadFile(ctx, []byte("done"), "setup.log"); err != nil {

panic(err)

}

// A filesystem snapshot requires a stopped sandbox

if err := sandbox.Stop(ctx); err != nil {

panic(err)

}

if err := sandbox.CreateSnapshot(ctx, "my-vm-snapshot"); err != nil {

panic(err)

}

// A sandbox created from the snapshot starts with the same filesystem

newSandbox, err := client.Create(ctx, types.SnapshotParams{Snapshot: "my-vm-snapshot"})

if err != nil {

panic(err)

}

content, err := newSandbox.FileSystem.DownloadFile(ctx, "setup.log", nil)

if err != nil {

panic(err)

}

fmt.Println(string(content)) // done

}
```

```
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);

// Write a file to the filesystem

sandbox.fs.uploadFile("done".getBytes(), "setup.log");

// A filesystem snapshot requires a stopped sandbox

sandbox.stop();

sandbox.createSnapshot("my-vm-snapshot");

// A sandbox created from the snapshot starts with the same filesystem

CreateSandboxFromSnapshotParams fromSnapshot = new CreateSandboxFromSnapshotParams();

fromSnapshot.setSnapshot("my-vm-snapshot");

Sandbox newSandbox = daytona.create(fromSnapshot);

byte[] content = newSandbox.fs.downloadFile("setup.log");

System.out.println(new String(content)); // done

}

}

}
```

```
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"}'

# Write a file to the filesystem

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/files/upload-v2?path=setup.log' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY' \

--form 'file=@setup.log'

# A filesystem snapshot requires a stopped sandbox

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/snapshot' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"name": "my-vm-snapshot",

"includeMemory": false

}'

# A sandbox created from the snapshot starts with the same filesystem

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"}'

curl 'https://proxy.app.daytona.io/toolbox/{newSandboxId}/files/download?path=setup.log' \

--header 'Authorization: Bearer YOUR_API_KEY'
```

## [\#](/content/docs/en/linux-sandboxes/\#memory-snapshot/index.html) Memory snapshot

[Section titled “Memory snapshot”](/content/docs/en/linux-sandboxes/#memory-snapshot/index.html)

A memory snapshot, also called a hot snapshot, saves the filesystem and memory of a started Linux VM sandbox. A sandbox created from a memory snapshot starts with its processes already running. Container sandboxes do not support memory snapshots.

- [API](/content/docs/en/linux-sandboxes/#tab-panel-689/index.html)

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/snapshot' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"name": "my-vm-snapshot",

"includeMemory": true

}'
```

## [\#](/content/docs/en/linux-sandboxes/\#filesystem-persistence/index.html) Filesystem persistence

[Section titled “Filesystem persistence”](/content/docs/en/linux-sandboxes/#filesystem-persistence/index.html)

Filesystem persistence keeps the contents of a sandbox’s disk: files, installed packages, cloned repositories, and build artifacts. A sandbox with a preserved filesystem starts with its environment intact, with nothing to reinstall or rebuild.

Linux sandboxes preserve their filesystem across [stop and start](/content/docs/en/linux-sandboxes/#stop--start/index.html), [archive](/content/docs/en/sandboxes#archive-sandboxes/index.html), and [filesystem snapshots](/content/docs/en/linux-sandboxes/#filesystem-snapshot/index.html) created from a sandbox. An [ephemeral sandbox](/content/docs/en/sandboxes#ephemeral-sandboxes/index.html) is deleted on stop, so its filesystem is not kept. The sandbox classes differ in where the preserved filesystem is stored.

| **Sandbox class** | **Filesystem persistence** |
| --- | --- |
| **Container** | Filesystem is preserved through stop and start: it stays on the runner and counts against disk quota while stopped. Archive moves it to object storage and frees the quota, and starting an archived sandbox restores it. Use filesystem snapshots to capture the filesystem. |
| **Linux VM** | Filesystem is preserved through stop and start: stopping offloads it to nearby storage and releases disk quota, starting restores it. Archive is not needed. Use filesystem snapshots to capture the filesystem. |

- [Container](/content/docs/en/linux-sandboxes/#tab-panel-812/index.html)
- [Linux VM](/content/docs/en/linux-sandboxes/#tab-panel-813/index.html)

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-737/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-738/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-739/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-740/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-741/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-742/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-743/index.html)

```
from daytona import Daytona

daytona = Daytona()

sandbox = daytona.create()

# Write a file to the filesystem

sandbox.fs.upload_file(b"done", "setup.log")

# Stop clears memory and keeps the filesystem

sandbox.stop()

# Start boots the sandbox from its filesystem

sandbox.start()

content = sandbox.fs.download_file("setup.log")

print(content.decode())  # done
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create()

// Write a file to the filesystem

await sandbox.fs.uploadFile(Buffer.from('done'), 'setup.log')

// Stop clears memory and keeps the filesystem

await sandbox.stop()

// Start boots the sandbox from its filesystem

await sandbox.start()

const content = await sandbox.fs.downloadFile('setup.log')

console.log(content.toString()) // done
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create

# Write a file to the filesystem

sandbox.fs.upload_file('done', 'setup.log')

# Stop clears memory and keeps the filesystem

sandbox.stop

# Start boots the sandbox from its filesystem

sandbox.start

content = sandbox.fs.download_file('setup.log')

puts content # done
```

```
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()

sandbox, err := client.Create(ctx, types.SnapshotParams{})

if err != nil {

panic(err)

}

// Write a file to the filesystem

if err := sandbox.FileSystem.UploadFile(ctx, []byte("done"), "setup.log"); err != nil {

panic(err)

}

// Stop clears memory and keeps the filesystem

if err := sandbox.Stop(ctx); err != nil {

panic(err)

}

// Start boots the sandbox from its filesystem

if err := sandbox.Start(ctx); err != nil {

panic(err)

}

content, err := sandbox.FileSystem.DownloadFile(ctx, "setup.log", nil)

if err != nil {

panic(err)

}

fmt.Println(string(content)) // done

}
```

```
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();

// Write a file to the filesystem

sandbox.fs.uploadFile("done".getBytes(), "setup.log");

// Stop clears memory and keeps the filesystem

sandbox.stop();

// Start boots the sandbox from its filesystem

sandbox.start();

byte[] content = sandbox.fs.downloadFile("setup.log");

System.out.println(new String(content)); // done

}

}

}
```

```
daytona create

# Write a file to the filesystem

daytona exec [SANDBOX_ID] -- sh -c 'echo done > setup.log'

# Stop clears memory and keeps the filesystem

daytona stop [SANDBOX_ID]

# Start boots the sandbox from its filesystem

daytona start [SANDBOX_ID]

daytona exec [SANDBOX_ID] -- cat setup.log
```

```
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{}'

# Write a file to the filesystem

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/files/upload-v2?path=setup.log' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY' \

--form 'file=@setup.log'

# Stop clears memory and keeps the filesystem

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Start boots the sandbox from its filesystem

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/start' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/files/download?path=setup.log' \

--header 'Authorization: Bearer YOUR_API_KEY'
```

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-744/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-745/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-746/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-747/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-748/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-749/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-750/index.html)

```
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="daytona-vm-small"))

# Write a file to the filesystem

sandbox.fs.upload_file(b"done", "setup.log")

# Stop clears memory and moves the filesystem to nearby storage

sandbox.stop()

# Start restores the filesystem and boots the sandbox

sandbox.start()

content = sandbox.fs.download_file("setup.log")

print(content.decode())  # done
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({ snapshot: 'daytona-vm-small' })

// Write a file to the filesystem

await sandbox.fs.uploadFile(Buffer.from('done'), 'setup.log')

// Stop clears memory and moves the filesystem to nearby storage

await sandbox.stop()

// Start restores the filesystem and boots the sandbox

await sandbox.start()

const content = await sandbox.fs.downloadFile('setup.log')

console.log(content.toString()) // done
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'daytona-vm-small'))

# Write a file to the filesystem

sandbox.fs.upload_file('done', 'setup.log')

# Stop clears memory and moves the filesystem to nearby storage

sandbox.stop

# Start restores the filesystem and boots the sandbox

sandbox.start

content = sandbox.fs.download_file('setup.log')

puts content # done
```

```
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()

sandbox, err := client.Create(ctx, types.SnapshotParams{Snapshot: "daytona-vm-small"})

if err != nil {

panic(err)

}

// Write a file to the filesystem

if err := sandbox.FileSystem.UploadFile(ctx, []byte("done"), "setup.log"); err != nil {

panic(err)

}

// Stop clears memory and moves the filesystem to nearby storage

if err := sandbox.Stop(ctx); err != nil {

panic(err)

}

// Start restores the filesystem and boots the sandbox

if err := sandbox.Start(ctx); err != nil {

panic(err)

}

content, err := sandbox.FileSystem.DownloadFile(ctx, "setup.log", nil)

if err != nil {

panic(err)

}

fmt.Println(string(content)) // done

}
```

```
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);

// Write a file to the filesystem

sandbox.fs.uploadFile("done".getBytes(), "setup.log");

// Stop clears memory and moves the filesystem to nearby storage

sandbox.stop();

// Start restores the filesystem and boots the sandbox

sandbox.start();

byte[] content = sandbox.fs.downloadFile("setup.log");

System.out.println(new String(content)); // done

}

}

}
```

```
daytona create --snapshot daytona-vm-small

# Write a file to the filesystem

daytona exec [SANDBOX_ID] -- sh -c 'echo done > setup.log'

# Stop clears memory and moves the filesystem to nearby storage

daytona stop [SANDBOX_ID]

# Start restores the filesystem and boots the sandbox

daytona start [SANDBOX_ID]

daytona exec [SANDBOX_ID] -- cat setup.log
```

```
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"}'

# Write a file to the filesystem

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/files/upload-v2?path=setup.log' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY' \

--form 'file=@setup.log'

# Stop clears memory and moves the filesystem to nearby storage

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Start restores the filesystem and boots the sandbox

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/start' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/files/download?path=setup.log' \

--header 'Authorization: Bearer YOUR_API_KEY'
```

## [\#](/content/docs/en/linux-sandboxes/\#memory-persistence/index.html) Memory persistence

[Section titled “Memory persistence”](/content/docs/en/linux-sandboxes/#memory-persistence/index.html)

Memory persistence keeps the runtime state of a sandbox: running processes, open connections, and everything loaded in RAM. A sandbox with preserved memory continues from the point it was frozen, with processes still running, instead of starting from a clean boot.

Linux VM sandboxes preserve their memory across [pause and resume](/content/docs/en/linux-sandboxes/#pause--resume/index.html), [memory snapshots](/content/docs/en/linux-sandboxes/#memory-snapshot/index.html) created from a sandbox, and [forks](/content/docs/en/linux-sandboxes/#fork/index.html). Memory state is cleared on every stop. The sandbox classes differ in whether memory can be preserved without keeping the sandbox running:

| **Sandbox class** | **Memory persistence** |
| --- | --- |
| **Container** | Memory persists only while the sandbox is running. Set the auto-stop interval to zero to run indefinitely, or relaunch processes after each start. Pause is not supported. |
| **Linux VM** | Memory is preserved through pause and resume: pausing freezes the VM with memory intact, resuming continues all processes from the point they were frozen. Use memory snapshots or forks to capture memory. |

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-751/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-752/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-753/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-754/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-755/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-756/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-757/index.html)

```
from daytona import Daytona, CreateSandboxFromSnapshotParams, SessionExecuteRequest

daytona = Daytona()

sandbox = daytona.create(CreateSandboxFromSnapshotParams(snapshot="daytona-vm-small"))

# Start a process that runs in the background

sandbox.process.create_session("keepalive")

response = sandbox.process.execute_session_command(

"keepalive",

SessionExecuteRequest(command="sleep 3600", run_async=True),

)

# Pause keeps the filesystem and memory

sandbox.pause()

# Start resumes every process from the point where the sandbox paused

sandbox.start()

command = sandbox.process.get_session_command("keepalive", response.cmd_id)

print(command.exit_code)  # None: the process is still running
```

```
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({ snapshot: 'daytona-vm-small' })

// Start a process that runs in the background

await sandbox.process.createSession('keepalive')

const response = await sandbox.process.executeSessionCommand('keepalive', {

command: 'sleep 3600',

runAsync: true,

})

// Pause keeps the filesystem and memory

await sandbox.pause()

// Start resumes every process from the point where the sandbox paused

await sandbox.start()

const command = await sandbox.process.getSessionCommand('keepalive', response.cmdId)

console.log(command.exitCode) // undefined: the process is still running
```

```
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(snapshot: 'daytona-vm-small'))

# Start a process that runs in the background

sandbox.process.create_session('keepalive')

response = sandbox.process.execute_session_command(

session_id: 'keepalive',

req: Daytona::SessionExecuteRequest.new(command: 'sleep 3600', run_async: true)

)

# Pause keeps the filesystem and memory

sandbox.pause

# Start resumes every process from the point where the sandbox paused

sandbox.start

command = sandbox.process.get_session_command(session_id: 'keepalive', command_id: response.cmd_id)

puts command.exit_code.inspect # nil: the process is still running
```

```
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()

sandbox, err := client.Create(ctx, types.SnapshotParams{Snapshot: "daytona-vm-small"})

if err != nil {

panic(err)

}

// Start a process that runs in the background

if err := sandbox.Process.CreateSession(ctx, "keepalive"); err != nil {

panic(err)

}

response, err := sandbox.Process.ExecuteSessionCommand(ctx, "keepalive", "sleep 3600", true, false)

if err != nil {

panic(err)

}

// Pause keeps the filesystem and memory

if err := sandbox.Pause(ctx); err != nil {

panic(err)

}

// Start resumes every process from the point where the sandbox paused

if err := sandbox.Start(ctx); err != nil {

panic(err)

}

command, err := sandbox.Process.GetSessionCommand(ctx, "keepalive", response["cmdId"].(string))

if err != nil {

panic(err)

}

fmt.Println(command["exitCode"]) // <nil>: the process is still running

}
```

```
import io.daytona.sdk.Daytona;

import io.daytona.sdk.Sandbox;

import io.daytona.sdk.model.Command;

import io.daytona.sdk.model.CreateSandboxFromSnapshotParams;

import io.daytona.sdk.model.SessionExecuteRequest;

import io.daytona.sdk.model.SessionExecuteResponse;

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);

// Start a process that runs in the background

sandbox.process.createSession("keepalive");

SessionExecuteResponse response = sandbox.process.executeSessionCommand(

"keepalive",

new SessionExecuteRequest("sleep 3600", true)

);

// Pause keeps the filesystem and memory

sandbox.pause();

// Start resumes every process from the point where the sandbox paused

sandbox.start();

Command command = sandbox.process.getSessionCommand("keepalive", response.getCmdId());

System.out.println(command.getExitCode()); // null: the process is still running

}

}

}
```

```
daytona create --snapshot daytona-vm-small

# Pause keeps the filesystem and memory

daytona pause [SANDBOX_ID]

# Start resumes every process from the point where the sandbox paused

daytona start [SANDBOX_ID]
```

```
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"}'

# Start a process that runs in the background

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/process/session' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{"sessionId": "keepalive"}'

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/process/session/keepalive/exec' \

--request POST \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{"command": "sleep 3600", "runAsync": true}'

# Pause keeps the filesystem and memory

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/pause' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Start resumes every process from the point where the sandbox paused

curl 'https://app.daytona.io/api/sandbox/{sandboxId}/start' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# The command has no exitCode while the process is still running

curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/process/session/keepalive/command/{commandId}' \

--header 'Authorization: Bearer YOUR_API_KEY'
```

## [\#](/content/docs/en/linux-sandboxes/\#lifecycle/index.html) Lifecycle

[Section titled “Lifecycle”](/content/docs/en/linux-sandboxes/#lifecycle/index.html)

Every Linux sandbox moves through a lifecycle. A Linux sandbox can have several different states. Each state reflects the status of your sandbox. A Linux sandbox transitions between states in response to user actions, or automatically when one of its [timeouts](/content/docs/en/linux-sandboxes/#timeouts/index.html) elapses.

sandbox.stop()auto-stop

sandbox.stop()

sandbox.delete()auto-delete

sandbox.start()

sandbox.start()

sandbox.archive()auto-archivecontainer

sandbox.pause()auto-pauseLinux VM

sandbox.start()

STARTED

STOPPED

PAUSED

ARCHIVED

DELETED

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.

Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

| **Feature** | **Container** | **Container (ephemeral)** | **Linux VM** | **Linux VM (ephemeral)** |
| --- | --- | --- | --- | --- |
| **Stop and start** | ✓ | ✗ | ✓ | ✗ |
| **Pause and resume** | ✗ | ✗ | ✓ | ✗ |
| **Fork** | ✗ | ✗ | ✓ | ✓ |
| **Archive** | ✓ | ✗ | ✗ | ✗ |
| **Delete** | ✓ | ✓ | ✓ | ✓ |
| **Filesystem persistence** | ✓ | ✗ | ✓ | ✗ |
| **Memory persistence** | ✗ | ✗ | ✓ | ✗ |
| **Memory snapshot** | ✗ | ✗ | ✓ | ✓ |
| **Filesystem snapshot** | ✓ | ✗ | ✓ | ✗ |
| **Nested virtualization** | ✗ | ✗ | ✓ | ✓ |
| **Desktop** | ✓ VNC | ✓ VNC | ✓ VNC | ✓ VNC |

| **State** | **Description** |
| --- | --- |
| **Pending Build** | The build is queued. |
| **Building Snapshot** | The sandbox is building a snapshot from an image. Container sandboxes only. |
| **Pulling Snapshot** | The sandbox is pulling a snapshot. |
| **Creating** | The sandbox is being created. |
| **Starting** | The sandbox is starting. |
| **Started** | The sandbox is running and accepts requests. |
| **Stopping** | The sandbox is stopping and does not accept new requests. |
| **Stopped** | The sandbox is stopped. The filesystem is kept and memory is cleared. |
| **Pausing** | The Linux VM sandbox is pausing. |
| **Paused** | The Linux VM sandbox is paused with its filesystem and memory preserved. |
| **Resuming** | The Linux VM sandbox is resuming from the paused state. |
| **Archiving** | The container sandbox filesystem is moving to object storage. |
| **Archived** | The container sandbox filesystem is in object storage. |
| **Restoring** | The sandbox is being restored. |
| **Resizing** | The sandbox resources are being changed. |
| **Snapshotting** | The sandbox is creating a memory snapshot or a filesystem snapshot. |
| **Forking** | The Linux VM sandbox is being forked. |
| **Deleting** | The sandbox is being deleted. |
| **Deleted** | The sandbox is deleted. |
| **Error** | The sandbox hit an error. A recoverable error can be recovered. |

Show more

| **Initial state** | **Target state** | **Trigger** |
| --- | --- | --- |
| **Started** | **Stopping** | A stop is requested, or the auto-stop interval elapses. |
| **Stopping** | **Stopped** | The shutdown completes. The filesystem is kept and memory is cleared. |
| **Stopped** | **Starting** | A start is requested. |
| **Started** | **Pausing** | A pause is requested on a Linux VM sandbox, or the auto-pause interval elapses. |
| **Pausing** | **Paused** | The filesystem and memory are preserved. |
| **Paused** | **Resuming** | A start is requested on a paused Linux VM sandbox. |
| **Paused** | **Stopping** | A stop is requested on a paused Linux VM sandbox. |
| **Resuming** | **Started** | The sandbox resumes from memory and is running. |
| **Stopped** | **Archiving** | An archive is requested on a container sandbox, or the auto-archive interval elapses. |
| **Archived** | **Restoring** | A start is requested on an archived container sandbox. |
| **Started** | **Snapshotting** | A memory snapshot is requested on a Linux VM sandbox. |
| **Stopped** | **Snapshotting** | A filesystem snapshot is requested. |
| **Started** | **Forking** | A fork is requested on a Linux VM sandbox. |
| **Started** | **Deleting** | A delete is requested, or an ephemeral sandbox is stopped. |
| **Stopped** | **Deleting** | A delete is requested, or the auto-delete interval elapses. |
| **Deleting** | **Deleted** | The sandbox is removed and its resources are released. |

Show more

### [\#](/content/docs/en/linux-sandboxes/\#wait-for-state/index.html) Wait for state

[Section titled “Wait for state”](/content/docs/en/linux-sandboxes/#wait-for-state/index.html)

Wait until a sandbox reaches the started or stopped state.

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-758/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-759/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-760/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-761/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-762/index.html)

```
sandbox.wait_for_sandbox_start(timeout=60)

sandbox.wait_for_sandbox_stop(timeout=60)
```

```
await sandbox.waitUntilStarted(60)

await sandbox.waitUntilStopped(60)
```

```
sandbox.wait_for_sandbox_start(60)

sandbox.wait_for_sandbox_stop(60)
```

```
err := sandbox.WaitForStart(ctx, 60*time.Second)

err = sandbox.WaitForStop(ctx, 60*time.Second)
```

```
sandbox.waitUntilStarted(60);

sandbox.waitUntilStopped(60);
```

### [\#](/content/docs/en/linux-sandboxes/\#stop--start/index.html) Stop / start

[Section titled “Stop / start”](/content/docs/en/linux-sandboxes/#stop--start/index.html)

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.

- [Container](/content/docs/en/linux-sandboxes/#tab-panel-823/index.html)
- [Linux VM](/content/docs/en/linux-sandboxes/#tab-panel-824/index.html)

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/start icon ⏹ / ▶ next to the sandbox you want to stop/start

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-763/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-764/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-765/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-766/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-767/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-768/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-769/index.html)

```
sandbox.stop()
```

```
sandbox.start()
```

```
await sandbox.stop()
```

```
await sandbox.start()
```

```
sandbox.stop
```

```
sandbox.start
```

```
sandbox.Stop(ctx)
```

```
sandbox.Start(ctx)
```

```
sandbox.stop();
```

```
sandbox.start();
```

```
daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
```

```
daytona start [SANDBOX_ID] | [SANDBOX_NAME] [flags]
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/start' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```

Stopping shuts down the virtual machine while preserving the filesystem. Memory state is cleared. To preserve running process state without consuming CPU, use [pause / resume](/content/docs/en/linux-sandboxes/#pause--resume/index.html).

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

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-770/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-771/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-772/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-773/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-774/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-775/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-776/index.html)

```
sandbox.stop()
```

```
sandbox.start()
```

```
await sandbox.stop()
```

```
await sandbox.start()
```

```
sandbox.stop
```

```
sandbox.start
```

```
sandbox.Stop(ctx)
```

```
sandbox.Start(ctx)
```

```
sandbox.stop();
```

```
sandbox.start();
```

```
daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]

daytona start [SANDBOX_ID] | [SANDBOX_NAME] [flags]
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/start' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```

### [\#](/content/docs/en/linux-sandboxes/\#pause--resume/index.html) Pause / resume

[Section titled “Pause / resume”](/content/docs/en/linux-sandboxes/#pause--resume/index.html)

Pause and resume a sandbox.

- [Container](/content/docs/en/linux-sandboxes/#tab-panel-825/index.html)
- [Linux VM](/content/docs/en/linux-sandboxes/#tab-panel-826/index.html)

Pause is not supported for container sandboxes. The filesystem can be preserved on stop, but memory state is not. Use [stop](/content/docs/en/linux-sandboxes/#stop--start/index.html) to shut down a container sandbox when it is not in use.

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

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-777/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-778/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-779/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-780/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-781/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-782/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-783/index.html)

```
sandbox.pause()
```

```
await sandbox.pause()
```

```
sandbox.pause
```

```
sandbox.Pause(ctx)
```

```
sandbox.pause();
```

```
daytona pause [SANDBOX_ID] | [SANDBOX_NAME]
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/pause' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```

### [\#](/content/docs/en/linux-sandboxes/\#fork/index.html) Fork

[Section titled “Fork”](/content/docs/en/linux-sandboxes/#fork/index.html)

Fork a sandbox.

- [Container](/content/docs/en/linux-sandboxes/#tab-panel-814/index.html)
- [Linux VM](/content/docs/en/linux-sandboxes/#tab-panel-815/index.html)

Forking is not supported for container sandboxes. Use [create snapshot from sandbox](/content/docs/en/snapshots#create-snapshot-from-sandbox/index.html) to capture filesystem state, then create a new sandbox from that snapshot.

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.

A fork of a [KVM sandbox](/content/docs/en/linux-sandboxes/#nested-virtualization/index.html) inherits the `kvm` setting. Forking a KVM sandbox returns a `403` error if KVM sandboxes are not enabled for your organization.

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

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-784/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-785/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-786/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-787/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-788/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-789/index.html)

```
# Fork sandbox through the Sandbox instance

forked = sandbox.fork(name="my-forked-sandbox")
```

```
// Fork sandbox through the Sandbox instance

const forkedSandbox = await sandbox.fork({ name: "my-forked-sandbox" });

// Or use the Daytona helper method

const helperForkedSandbox = await daytona.fork(sandbox, { name: "my-forked-sandbox" });
```

```
# Fork sandbox through the Sandbox instance

forkedSandbox = sandbox.fork(name: "my-forked-sandbox")
```

```
// Fork sandbox through the Sandbox instance

name := "my-forked-sandbox"

forkedSandbox, err := sandbox.Fork(ctx, &name)

if err != nil {

return err

}
```

```
// Fork sandbox through the Sandbox instance

Sandbox forkedSandbox = sandbox.fork("my-forked-sandbox", 60);
```

```
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:

```
# 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'
```

### [\#](/content/docs/en/linux-sandboxes/\#delete/index.html) Delete

[Section titled “Delete”](/content/docs/en/linux-sandboxes/#delete/index.html)

Delete a sandbox.

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

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-790/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-791/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-792/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-793/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-794/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-795/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-796/index.html)

```
sandbox.delete()

# Block until the sandbox is deleted

sandbox.delete(timeout=60, wait=True)
```

```
await sandbox.delete()

// Block until the sandbox is deleted

await sandbox.delete(60, true)
```

```
sandbox.delete

# Block until the sandbox is deleted

sandbox.delete(60, wait: true)
```

```
err = sandbox.Delete(ctx)

// Block until the sandbox is deleted

err = sandbox.DeleteAndWait(ctx, 60*time.Second)
```

```
sandbox.delete();

// Block until the sandbox is deleted

sandbox.delete(60, true);
```

```
daytona delete [SANDBOX_ID] | [SANDBOX_NAME]
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}' \

--request DELETE \

--header 'Authorization: Bearer YOUR_API_KEY'
```

### [\#](/content/docs/en/linux-sandboxes/\#timeouts/index.html) Timeouts

[Section titled “Timeouts”](/content/docs/en/linux-sandboxes/#timeouts/index.html)

Daytona stops, pauses, archives, or deletes a sandbox when a timeout elapses. Each timeout is set in minutes. Zero disables auto-stop, auto-pause, and wall-clock TTL. Zero does not disable auto-archive or auto-delete: auto-archive set to zero uses the maximum interval of 30 days, and auto-delete set to zero deletes the sandbox as soon as it stops. To disable auto-delete, set it to -1.

| **Interval** | **Container** | **Linux VM** | **Action** |
| --- | --- | --- | --- |
| **Auto-stop** | ✓ (default 15 minutes) | ✓ | Stops the sandbox after inactivity. |
| **Auto-pause** | ✗ | ✓ (default 60 minutes) | Pauses the sandbox after inactivity. |
| **Auto-archive** | ✓ | ✗ | Archives a stopped sandbox. |
| **Auto-delete** | ✓ | ✓ | Deletes a stopped sandbox. |
| **Wall-clock TTL** | ✓ | ✓ | Deletes the sandbox at a fixed deadline, in any state. |

#### [\#](/content/docs/en/linux-sandboxes/\#auto-pause/index.html) Auto-pause

[Section titled “Auto-pause”](/content/docs/en/linux-sandboxes/#auto-pause/index.html)

The auto-pause interval sets the amount of time after which an idle VM sandbox is automatically [paused](/content/docs/en/linux-sandboxes/#pause--resume/index.html). Auto-pause applies only to [VM sandboxes](/content/docs/en/sandboxes#vm-sandboxes/index.html) and is mutually exclusive with the [auto-stop interval](/content/docs/en/sandboxes#auto-stop-interval/index.html): 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](/content/docs/en/preview/index.html) do not reset the timer.

- [Container](/content/docs/en/linux-sandboxes/#tab-panel-816/index.html)
- [Linux VM](/content/docs/en/linux-sandboxes/#tab-panel-817/index.html)
- [GPU](/content/docs/en/linux-sandboxes/#tab-panel-818/index.html)

Auto-pause is not supported for container sandboxes. Use [auto-stop](/content/docs/en/sandboxes#auto-stop-interval/index.html) to stop a container sandbox after a period of inactivity.

1. Go to [Daytona Sandboxes ↗](https://app.daytona.io/dashboard/sandboxes)
2. Click Create Sandbox
3. Select a Linux VM snapshot
4. Set **`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 Create

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-797/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-798/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-799/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-800/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-801/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-802/index.html)

```
from daytona import CreateSandboxFromSnapshotParams

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)
```

```
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)
```

```
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
```

```
// 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)
```

```
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);

}

}

}
```

```
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autopause/{interval}' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```

Auto-pause is not supported for GPU sandboxes. GPU sandboxes are ephemeral and cannot have auto-pause enabled.

#### [\#](/content/docs/en/linux-sandboxes/\#wall-clock-ttl/index.html) Wall-clock TTL

[Section titled “Wall-clock TTL”](/content/docs/en/linux-sandboxes/#wall-clock-ttl/index.html)

The wall-clock TTL (time-to-live) sets a hard upper bound on how long a sandbox may exist. Unlike the [auto-delete interval](/content/docs/en/sandboxes#auto-delete-interval/index.html), 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.

- [Python](/content/docs/en/linux-sandboxes/#tab-panel-803/index.html)
- [TypeScript](/content/docs/en/linux-sandboxes/#tab-panel-804/index.html)
- [Ruby](/content/docs/en/linux-sandboxes/#tab-panel-805/index.html)
- [Go](/content/docs/en/linux-sandboxes/#tab-panel-806/index.html)
- [Java](/content/docs/en/linux-sandboxes/#tab-panel-807/index.html)
- [CLI](/content/docs/en/linux-sandboxes/#tab-panel-808/index.html)
- [API](/content/docs/en/linux-sandboxes/#tab-panel-809/index.html)

```
sandbox = daytona.create(CreateSandboxFromSnapshotParams(

snapshot="daytona-vm-small",

ttl_minutes=120,

))

# Reset the deadline to 60 minutes from now

sandbox.set_ttl(60)
```

```
const sandbox = await daytona.create({

snapshot: 'daytona-vm-small',

ttlMinutes: 120,

})

// Reset the deadline to 60 minutes from now

await sandbox.setTtl(60)
```

```
sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'daytona-vm-small',

ttl_minutes: 120

)

)

# Reset the deadline to 60 minutes from now

sandbox.ttl_minutes = 60
```

```
ttlMinutes := 120

sandbox, err := client.Create(ctx, types.SnapshotParams{

Snapshot: "daytona-vm-small",

SandboxBaseParams: types.SandboxBaseParams{

TtlMinutes: &ttlMinutes,

},

})
```

```
CreateSandboxFromSnapshotParams params = new CreateSandboxFromSnapshotParams();

params.setSnapshot("daytona-vm-small");

params.setTtlMinutes(120);

Sandbox sandbox = daytona.create(params);

// Reset the deadline to 60 minutes from now

sandbox.setTtl(60);
```

```
daytona create --snapshot daytona-vm-small --ttl 120
```

```
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",

"ttlMinutes": 120

}'

# Reset the deadline to 60 minutes from now

curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/ttl/60' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
```
