Sandboxes | Daytona

Sandboxes

Copy for LLMView as MarkdownOpen

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 with a dedicated Linux VM or Windows operating system, GPU sandboxes with NVIDIA and AMD GPU acceleration for CUDA development, 3D and graphics workloads, and other GPU-accelerated compute, and macOS sandboxes running on dedicated Apple silicon hardware.

Container\ Default Linux container runtime for running processes and executing code.\ <90msDynamic buildsDocker images Linux VM\ Linux OS runtime in a virtual machine for running Linux-specific tools and workflows.\ ForkPause/resumeMemory snapshots Windows\ Windows OS runtime in a virtual machine for running Windows applications and tooling.\ ForkPause/resumeMemory snapshots macOS\ macOS runtime for automating applications and desktop interactions.\ Computer UseVNCSSH GPU\ NVIDIA and AMD GPU runtime for CUDA development, 3D and graphics workloads, and other GPU-accelerated compute.\ H100/H200/B200/B300RTXMI355X

# Create sandboxes

Section titled “Create sandboxes”

Create a sandbox.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Click Create
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 [flags]
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{}'

# Snapshots

Section titled “Snapshots”

Create a sandbox from a default snapshot.

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 ↗
  2. Click Create Sandbox
  3. Select a Snapshot
  4. Click Create
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromSnapshotParams(

snapshot="daytona-small",

)

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

const daytona = new Daytona()

const sandbox = await daytona.create({

snapshot: 'daytona-small',

})
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'daytona-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()

params := types.SnapshotParams{

Snapshot: "daytona-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-small");

Sandbox sandbox = daytona.create(params);

}

}

}
daytona create --snapshot daytona-small
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"snapshot": "daytona-small"

}'

# Images

Section titled “Images”

Create a sandbox from an image. The image must be publicly accessible and include either a tag or a digest (e.g. ubuntu:22.04); the latest/ lts/ stable tags are not supported.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Enter an Image (e.g. ubuntu:22.04) as the source for the sandbox
  4. Click Create
from daytona import Daytona, CreateSandboxFromImageParams

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromImageParams(

image="ubuntu:22.04",

)

)
import { Daytona, Image } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({

image: Image.base('ubuntu:22.04'),

})
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromImageParams.new(

image: Daytona::Image.base('ubuntu:22.04')

)

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

})

}
import io.daytona.sdk.Daytona;

import io.daytona.sdk.Sandbox;

import io.daytona.sdk.model.CreateSandboxFromImageParams;

public class App {

public static void main(String[] args) {

try (Daytona daytona = new Daytona()) {

CreateSandboxFromImageParams params = new CreateSandboxFromImageParams();

params.setImage("ubuntu:22.04");

Sandbox sandbox = daytona.create(params);

}

}

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

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"buildInfo": {

"dockerfileContent": "FROM ubuntu:22.04\n"

}

}'

# Resources

Section titled “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 ↗
  2. Click Create Sandbox
  3. Enter an Image (e.g. ubuntu:22.04) as the source for the sandbox
  4. Set Resources ( cpu, memory, disk) to the values within your organization’s limits
  5. Click Create
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),

)

)
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 },

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

)

)

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

},

})

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

}

}

}
daytona create --cpu 2 --memory 4 --disk 8
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"buildInfo": {

"dockerfileContent": "FROM ubuntu:22.04\n"

},

"cpu": 2,

"memory": 4,

"disk": 8

}'

# Languages

Section titled “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.

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

}
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());
# Python runtime (default)

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

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"labels": {

"code-toolbox-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 '{

"labels": {

"code-toolbox-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 '{

"labels": {

"code-toolbox-language": "javascript"

}

}'

# Environment variables

Section titled “Environment variables”

Create a sandbox with environment variables. Use secrets for API keys, tokens, and passwords.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Click Add Variable and enter key-value pairs for each environment variable
  4. Click Create
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(CreateSandboxFromSnapshotParams(

env_vars={"DEBUG": "true", "LOG_LEVEL": "info"},

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

const daytona = new Daytona()

const sandbox = await daytona.create({

envVars: { DEBUG: 'true', LOG_LEVEL: 'info' },

})
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(

env_vars: { 'DEBUG' => 'true', 'LOG_LEVEL' => 'info' }

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

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

}

}

}
daytona create -e DEBUG=true -e LOG_LEVEL=info
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"

}

}'

# Regions

Section titled “Regions”

Create a sandbox in a specific region.

Region Target
United States us
Europe eu
  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Set Region to the target region you want to create the sandbox in
  4. Click Create
from daytona import Daytona, DaytonaConfig

daytona = Daytona(DaytonaConfig(target="us"))

sandbox = daytona.create()
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona({ target: 'us' })

const sandbox = await daytona.create()
require 'daytona'

daytona = Daytona::Daytona.new(Daytona::Config.new(target: 'us'))

sandbox = daytona.create
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)

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

}

}

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

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"target": "us"

}'

# VM sandboxes

Section titled “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:

Create a Linux VM sandbox.

  1. Go to Daytona Snapshots ↗
  2. Click Create Snapshot
  3. Enter Snapshot Name (e.g. my-vm-snapshot)
  4. Enter an Image (e.g. ubuntu:22.04)
  5. Select Sandbox Class: LINUX_VM
  6. Click Create
  7. Go to Daytona Sandboxes ↗
  8. Click Create Sandbox
  9. Select a VM Snapshot (e.g. my-vm-snapshot)
  10. Click Create
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"))
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" });
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'))
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",

})

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

}

}

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

}'

Create a Linux VM sandbox from a default snapshot.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Select a VM Snapshot: daytona-vm-small, daytona-vm-medium, daytona-vm-large
  4. Click Create
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()

params := types.SnapshotParams{

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

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 Windows sandbox.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Select a Windows Snapshot: windows-small, windows-medium, windows-large
  4. Click Create
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromSnapshotParams(

snapshot="windows-small",

)

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

const daytona = new Daytona()

const sandbox = await daytona.create({

snapshot: 'windows-small',

})
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'windows-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()

params := types.SnapshotParams{

Snapshot: "windows-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("windows-small");

Sandbox sandbox = daytona.create(params);

}

}

}
daytona create --snapshot windows-small
curl 'https://app.daytona.io/api/sandbox' \

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"snapshot": "windows-small"

}'

# Nested virtualization

Section titled “Nested virtualization”

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.

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

}'

# macOS sandboxes

Section titled “macOS sandboxes”

Daytona provides macOS sandboxes for agents that need a macOS operating system.

  1. Go to use.computer ↗
  2. Obtain an API key
  3. Reserve a Mac
  4. Use the API key to create a macOS sandbox
curl 'https://api.use.computer/v1/sandboxes' \

--request POST \

--header 'Authorization: Bearer YOUR_USE_COMPUTER_API_KEY' \

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

--data '{"type":"macos"}'

# GPU sandboxes

Section titled “GPU sandboxes”

Daytona provides GPU sandboxes for agents doing GPU-accelerated work, such as writing and profiling CUDA kernels, 3D and graphics workloads, and other GPU-accelerated compute. GPU sandboxes are ephemeral and support up to 8 GPUs. Resource limits scale with the number of GPU units: each GPU adds up to 16 vCPUs, 192GB RAM, and 512GB disk. Supported NVIDIA and AMD GPU types:

GPU sandboxes are on-demand. See spot GPU sandboxes for preemptible GPU capacity. Use the GPU capacity endpoint to check available GPU units before creating a sandbox. When no GPU capacity is available, a GPU sandbox waits until capacity frees up.

GPU sandboxes on shared regions run in the earth region. Daytona selects the shared region, ignores the requested target, and reports earth as the sandbox target. GPU sandboxes on dedicated and custom regions keep their real region ID. To run GPU sandboxes in a specific geographic location, contact support@daytona.io.

Create a GPU sandbox with custom GPU resources: units and types.

  1. Go to Daytona Sandboxes ↗

  2. Click Create Sandbox

  3. Enter an Image (e.g. pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime)

  4. Set GPU to the number of GPU units (e.g. 1)

  5. Select GPU Type: H100, H200, B200, B300, RTX-PRO-6000, RTX-4090, RTX-5090, MI355X

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.

from daytona import Daytona, CreateSandboxFromImageParams, Resources, GpuType

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromImageParams(

image="pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime",

auto_delete_interval=0,

resources=Resources(

gpu=1,

gpu_type=[GpuType.H100, GpuType.RTX_PRO_6000],

),

)

)
import { Daytona, GpuType } from "@daytona/sdk";

const daytona = new Daytona()

const sandbox = await daytona.create({

image: "pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime",

autoDeleteInterval: 0,

resources: {

gpu: 1,

gpuType: [GpuType.H100, GpuType.RTX_PRO_6000],

},

});
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromImageParams.new(

image: 'pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime',

auto_delete_interval: 0,

resources: Daytona::Resources.new(

gpu: 1,

gpu_type: [Daytona::GpuType::H100, Daytona::GpuType::RTX_PRO_6000]

)

)

)
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: "pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime",

SandboxBaseParams: types.SandboxBaseParams{

AutoDeleteInterval: &autoDelete,

},

Resources: &types.Resources{

GPU:     1,

GpuType: []types.GpuType{types.GpuTypeH100, types.GpuTypeRtxPro6000},

},

})

}
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("pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime");

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

}

}

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

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"buildInfo": {

"dockerfileContent": "FROM pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime\n"

},

"autoDeleteInterval": 0,

"gpu": 1,

"gpuType": ["H100", "RTX-PRO-6000"]

}'

Create a GPU sandbox from a default snapshot.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Select a GPU Snapshot: daytona-gpu
  4. Click Create
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromSnapshotParams(

snapshot="daytona-gpu",

auto_delete_interval=0,

),

)
import { Daytona } from "@daytona/sdk";

const daytona = new Daytona()

const sandbox = await daytona.create({

snapshot: "daytona-gpu",

ephemeral: true,

});
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'daytona-gpu',

ephemeral: 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{

Snapshot: "daytona-gpu",

SandboxBaseParams: types.SandboxBaseParams{

Ephemeral: true,

},

}

_, _ = 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-gpu");

params.setAutoDeleteInterval(0);

Sandbox sandbox = daytona.create(params);

}

}

}
daytona create --snapshot daytona-gpu --auto-delete 0
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 GPU sandboxes

Section titled “Spot GPU sandboxes”

Spot GPU sandboxes are preemptible and run on GPU capacity that is not being used by reserved (on-demand) sandboxes. They support the same GPU types, unit counts, and resource limits as on-demand GPU 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 updates still apply. Daytona records when the preemption occurred with a spotEvictedAt timestamp. Sandboxes destroyed by spot GPU preemption remain retrievable for 24 hours.

Spot GPU sandboxes require Tier 2 or higher. 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.

Create a spot GPU sandbox with custom GPU resources: units and types.

from daytona import Daytona, CreateSandboxFromImageParams, Resources, GpuType

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromImageParams(

image="pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime",

auto_delete_interval=0,

spot=True,

resources=Resources(gpu=1, gpu_type=GpuType.H100),

)

)
import { Daytona, GpuType } from "@daytona/sdk";

const daytona = new Daytona()

const sandbox = await daytona.create({

image: "pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime",

autoDeleteInterval: 0,

spot: true,

resources: {

gpu: 1,

gpuType: GpuType.H100,

},

});
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromImageParams.new(

image: 'pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime',

auto_delete_interval: 0,

spot: true,

resources: Daytona::Resources.new(gpu: 1, gpu_type: Daytona::GpuType::H100)

)

)
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: "pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime",

SandboxBaseParams: types.SandboxBaseParams{

AutoDeleteInterval: &autoDelete,

Spot:               true,

},

Resources: &types.Resources{

GPU:     1,

GpuType: []types.GpuType{types.GpuTypeH100},

},

})

}
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("pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime");

params.setAutoDeleteInterval(0);

params.setSpot(true);

Resources resources = new Resources();

resources.setGpu(1);

resources.setGpuType(List.of(GpuType.H100));

params.setResources(resources);

Sandbox sandbox = daytona.create(params);

}

}

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

--request POST \

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

--header 'Authorization: Bearer YOUR_API_KEY' \

--data '{

"buildInfo": {

"dockerfileContent": "FROM pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime\n"

},

"autoDeleteInterval": 0,

"spot": true,

"gpu": 1,

"gpuType": ["H100"]

}'

Create a spot GPU sandbox from a default snapshot.

from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

sandbox = daytona.create(

CreateSandboxFromSnapshotParams(

snapshot="daytona-gpu",

auto_delete_interval=0,

spot=True,

),

)
import { Daytona } from "@daytona/sdk";

const daytona = new Daytona()

const sandbox = await daytona.create({

snapshot: "daytona-gpu",

autoDeleteInterval: 0,

spot: true,

});
require 'daytona'

daytona = Daytona::Daytona.new

sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'daytona-gpu',

auto_delete_interval: 0,

spot: 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()

autoDelete := 0

params := types.SnapshotParams{

Snapshot: "daytona-gpu",

SandboxBaseParams: types.SandboxBaseParams{

AutoDeleteInterval: &autoDelete,

Spot:               true,

},

}

_, _ = 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-gpu");

params.setAutoDeleteInterval(0);

params.setSpot(true);

Sandbox sandbox = daytona.create(params);

}

}

}
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

}'

# GPU capacity

Section titled “GPU capacity”

Get the available GPU capacity. The response lists available GPU units by GPU type, split into on-demand and spot. Capacity is aggregated across all shared regions in the earth region and changes as sandboxes are created and deleted. The response does not reserve capacity and does not apply the organization’s GPU quota. On-demand GPU sandboxes remain subject to the quota. Spot GPU sandboxes are limited only by available capacity.

curl 'https://app.daytona.io/api/organizations/ORGANIZATION_ID/gpu-capacity' \

--header 'Authorization: Bearer YOUR_API_KEY'

Response example:

{

"observedAt": "2026-09-14T17:31:05.412Z",

"capacity": [\
\
    { "gpuType": "H100", "availableOnDemand": 12, "availableSpot": 4 },\
\
    { "gpuType": "H200", "availableOnDemand": 0, "availableSpot": 0 },\
\
    { "gpuType": "RTX-PRO-6000", "availableOnDemand": 6, "availableSpot": 6 }\
\
  ]

}
Field Description
observedAt Time the capacity was calculated. Responses are cached for up to five seconds.
capacity One entry per GPU type.
gpuType H100, H200, B200, B300, RTX-PRO-6000, RTX-4090, RTX-5090, or MI355X.
availableOnDemand GPU units available to on-demand GPU sandboxes. Includes units held by spot GPU sandboxes that Daytona can reclaim.
availableSpot GPU units currently free for spot GPU sandboxes.

# Ephemeral sandboxes

Section titled “Ephemeral sandboxes”

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

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Set Ephemeral or set the auto-delete interval to 0
  4. Click Create
from daytona import Daytona, CreateSandboxFromSnapshotParams

daytona = Daytona()

params = CreateSandboxFromSnapshotParams(

ephemeral=True,

auto_stop_interval=5,

)

sandbox = daytona.create(params)
import { Daytona } from '@daytona/sdk'

const daytona = new Daytona()

const sandbox = await daytona.create({

ephemeral: true,

autoStopInterval: 5,

})
require 'daytona'

daytona = Daytona::Daytona.new

params = Daytona::CreateSandboxFromSnapshotParams.new(

ephemeral: true,

auto_stop_interval: 5

)

sandbox = daytona.create(params)
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)

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

}

}

}
daytona create --auto-delete 0 --auto-stop 5
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

}'

# Linked sandboxes

Section titled “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.

Linked sandboxes are always ephemeral and cannot be persisted or resumed after stop. The auto-delete interval must be exactly 0 on create; this is enforced, not a default. The 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).

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.

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

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

}
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/");

}

}

}
# 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

}'

# Sandbox operations

Section titled “Sandbox operations”

Sandbox operations manage sandboxes after creation. They cover discovery, inspection, and updates to sandbox metadata and resources. Once a sandbox exists, you can find it among others in your organization, inspect its configuration, and update attributes such as metadata and allocated resources. A sandbox transitions between states such as started, stopped, paused, and archived as part of the sandbox lifecycle.

# List sandboxes

Section titled “List sandboxes”

List sandboxes.

for sandbox in daytona.list():

print(sandbox.id)
for await (const sandbox of daytona.list()) {

console.log(sandbox.id)

}
daytona.list.each { |sandbox| puts sandbox.id }
iter := client.List(ctx, nil)

for iter.Next() {

sandbox := iter.Value()

fmt.Println(sandbox.ID)

}

if err := iter.Err(); err != nil {

log.Fatal(err)

}
for (Sandbox sandbox : daytona.list()) {

System.out.println(sandbox.getId());

}
daytona list [flags]
curl 'https://app.daytona.io/api/sandbox' \

--header 'Authorization: Bearer YOUR_API_KEY'

# Get sandbox

Section titled “Get sandbox”

Get a sandbox by ID or name.

sandbox = daytona.get("my-sandbox-id-or-name")
const sandbox = await daytona.get('my-sandbox-id-or-name')
sandbox = daytona.get('my-sandbox-id-or-name')
sandbox, err := client.Get(ctx, "my-sandbox-id-or-name")
Sandbox sandbox = daytona.get("my-sandbox-id-or-name");
daytona info [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}' \

--header 'Authorization: Bearer YOUR_API_KEY'

# Label sandboxes

Section titled “Label sandboxes”

Set sandbox labels.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Click Add Labels
  4. Enter the labels in key-value pairs
sandbox.set_labels({

"team": "platform",

"env": "staging",

})
await sandbox.setLabels({

team: 'platform',

env: 'staging',

})
sandbox.labels = {

team: 'platform',

env: 'staging'

}
err := sandbox.SetLabels(ctx, map[string]string{

"team": "platform",

"env":  "staging",

})
Map<String, String> labels = new HashMap<>();

labels.put("team", "platform");

labels.put("env", "staging");

sandbox.setLabels(labels);
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"

}

}'

# Resize sandboxes

Section titled “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 the 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
from daytona import Resources

# 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()
// 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()
# 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
// 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)
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

}'

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.

cat /sys/fs/cgroup/cpu.max      # "<quota> <period>" (cores = quota / period)

cat /sys/fs/cgroup/memory.max   # bytes

df -h /                         # disk

# Sandbox lifecycle

Section titled “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 based on inactivity intervals. Available lifecycle features depend on the sandbox class.

sandbox.stop()auto-stop

sandbox.stop()

sandbox.delete()auto-delete

sandbox.start()

sandbox.start()

sandbox.archive()auto-archive

sandbox.pause()auto-pause

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.

Lifecycle feature Container Linux VM Windows GPU
Start sandboxes ✓ ✓ ✓ ✓
Pause / resume sandboxes ✗ ✓ ✓ ✗
Stop sandboxes ✓ ✓ ✓ ✓
Archive sandboxes ✓ ✗ ✗ ✗
Fork sandboxes ✗ ✓ ✓ ✗
Snapshot from sandbox
(filesystem only)
✓ ✓ ✓ ✓
Snapshot from sandbox
(filesystem + memory)
✗ ✓ ✓ ✗
State Description
Creating The sandbox is provisioning and will be ready to use.
Pulling Snapshot The sandbox is pulling a snapshot to provide a base environment.
Building Snapshot The sandbox is building a snapshot to provide a base environment.
Pending Build The sandbox build is pending and will start shortly. GPU sandboxes wait in this state until GPU capacity is available.
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 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.

Show more

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.

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.

Show more

# Start sandboxes

Section titled “Start sandboxes”

Start a sandbox.

  1. Go to Daytona Sandboxes ↗
  2. Click the start icon ▶ next to the sandbox you want to start
sandbox.start()
await sandbox.start()
sandbox.start
sandbox.Start(ctx)
sandbox.start();
daytona start [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/start' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Pause / resume sandboxes

Section titled “Pause / resume sandboxes”

Pause and resume a sandbox.

Pause is not supported for container sandboxes. The filesystem can be preserved on stop, but memory state is not. Use stop 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
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'

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

# Stop sandboxes

Section titled “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.

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 ↗
  2. Click the stop icon ( ⏹) next to the sandbox you want to stop
sandbox.stop()
await sandbox.stop()
sandbox.stop
sandbox.Stop(ctx)
sandbox.stop();
daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \

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

  1. Go to Daytona Sandboxes ↗
  2. Click the stop icon ( ⏹) next to the sandbox you want to stop
sandbox.stop()
await sandbox.stop()
sandbox.stop
sandbox.Stop(ctx)
sandbox.stop();
daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
  1. Go to Daytona Sandboxes ↗
  2. Click the stop icon ( ⏹) next to the sandbox you want to stop
sandbox.stop()
await sandbox.stop()
sandbox.stop
sandbox.Stop(ctx)
sandbox.stop();
daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Archive sandboxes

Section titled “Archive sandboxes”

Archive a sandbox.

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
sandbox.archive()
await sandbox.archive()
sandbox.archive
sandbox.Archive(ctx)
daytona archive [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/archive' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

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.

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.

# Delete sandboxes

Section titled “Delete sandboxes”

Delete a sandbox.

  1. Go to Daytona Sandboxes ↗
  2. Click Delete next to the sandbox you want to delete.
sandbox.delete()

# Block until the sandbox is destroyed

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

// Block until the sandbox is destroyed

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

# Block until the sandbox is destroyed

sandbox.delete(60, wait: true)
err = sandbox.Delete(ctx)

// Block until the sandbox is destroyed

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

// Block until the sandbox is destroyed

sandbox.delete(60, true);
daytona delete [SANDBOX_ID] | [SANDBOX_NAME] [flags]
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}' \

--request DELETE \

--header 'Authorization: Bearer YOUR_API_KEY'

# Recover sandboxes

Section titled “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
# Check if the sandbox is recoverable

if sandbox.recoverable:

sandbox.recover()
sandbox.recover()
// Check if the sandbox is recoverable

if (sandbox.recoverable) {

await sandbox.recover()

}
await sandbox.recover()
# Check if the sandbox is in an error state before recovering

if sandbox.state == 'error'

sandbox.recover

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

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'
curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/recover' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Fork sandboxes

Section titled “Fork sandboxes”

Fork a sandbox.

Forking is not supported for container sandboxes. Use create snapshot from sandbox 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 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 ↗
  2. Click the three-dot menu ( ⋮) next to the started Linux VM sandbox you want to fork
  3. Select Fork
# 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'

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.

  1. Go to Daytona Sandboxes ↗
  2. Click the three-dot menu ( ⋮) next to the started Windows sandbox you want to fork
  3. Select Fork
# 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'

# Automated lifecycle management

Section titled “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 sandboxes

Section titled “Auto-stop sandboxes”

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 ↗
  2. Click Create Sandbox
  3. Set auto-stop interval to the desired value in minutes
  1. Click Create
from daytona import CreateSandboxFromSnapshotParams

sandbox = daytona.create(CreateSandboxFromSnapshotParams(

snapshot="my-snapshot",

# Disables the auto-stop feature - default is 15 minutes

auto_stop_interval=0,

))
const sandbox = await daytona.create({

snapshot: 'my-snapshot',

// Disables the auto-stop feature - default is 15 minutes

autoStopInterval: 0,

})
sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'my-snapshot',

# Disables the auto-stop feature - default is 15 minutes

auto_stop_interval: 0

)

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

}

}

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

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

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

Section titled “What resets the timer”

The inactivity timer resets only for specific external interactions:

# What does not reset the timer

Section titled “What does not reset the timer”

The following do not reset the timer:

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 sandboxes

Section titled “Auto-pause sandboxes”

The auto-pause interval sets the amount of time after which an idle VM sandbox is automatically paused. Auto-pause applies only to VM sandboxes and is mutually exclusive with the 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:

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 do not reset the timer.

Auto-pause is not supported for container sandboxes. Use auto-stop to stop a container sandbox after a period of inactivity.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Select a Linux VM snapshot
  4. Set auto-pause interval to the desired value in minutes
  1. Click Create
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'
  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Select a Windows snapshot
  4. Set auto-pause interval to the desired value in minutes
from daytona import CreateSandboxFromSnapshotParams

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

}

}

}
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.

# Auto-archive sandboxes

Section titled “Auto-archive sandboxes”

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 ↗
  2. Click Create Sandbox
  3. Set auto-archive interval to the desired value in minutes
  1. Click Create
from daytona import CreateSandboxFromSnapshotParams

sandbox = daytona.create(CreateSandboxFromSnapshotParams(

snapshot="my-snapshot",

# Auto-archive after a sandbox has been stopped for 1 hour

auto_archive_interval=60,

))
const sandbox = await daytona.create({

snapshot: 'my-snapshot',

// Auto-archive after a sandbox has been stopped for 1 hour

autoArchiveInterval: 60,

})
sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'my-snapshot',

# Auto-archive after a sandbox has been stopped for 1 hour

auto_archive_interval: 60

)

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

}

}

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

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Auto-delete sandboxes

Section titled “Auto-delete sandboxes”

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

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Set auto-delete to the desired value in minutes
  1. Click Create
from daytona import CreateSandboxFromSnapshotParams

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

}

}

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

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Wall-clock TTL

Section titled “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, 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:

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.

from daytona import CreateSandboxFromSnapshotParams

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

}

}

}
# Destroy the sandbox 2 hours after creation, regardless of state

daytona create --ttl 120
# 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'

# Update sandbox last activity

Section titled “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.

sandbox.refresh_activity()
await sandbox.refreshActivity()
sandbox.refresh_activity
curl 'https://app.daytona.io/api/sandbox/{sandboxId}/last-activity' \

--request POST \

--header 'Authorization: Bearer YOUR_API_KEY'

# Running indefinitely

Section titled “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: if ttl_minutes is set, the sandbox is still destroyed when that deadline elapses.

  1. Go to Daytona Sandboxes ↗
  2. Click Create Sandbox
  3. Set auto-stop to 0
  4. Click Create
from daytona import CreateSandboxFromSnapshotParams

sandbox = daytona.create(CreateSandboxFromSnapshotParams(

snapshot="my_awesome_snapshot",

# Disables the auto-stop feature - default is 15 minutes

auto_stop_interval=0,

))
const sandbox = await daytona.create({

snapshot: 'my_awesome_snapshot',

// Disables the auto-stop feature - default is 15 minutes

autoStopInterval: 0,

})
sandbox = daytona.create(

Daytona::CreateSandboxFromSnapshotParams.new(

snapshot: 'my_awesome_snapshot',

# Disables the auto-stop feature - default is 15 minutes

auto_stop_interval: 0

)

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

}

}

}