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 get access to a full composable computer environment where they can install packages, run servers, compile code, and manage processes.
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. For more power, see resources or contact support@daytona.io.
Sandboxes use snapshots to capture a fully configured environment (base OS, installed packages, dependencies, and configuration) to create new sandboxes.
Each sandbox has its own network stack with per-sandbox firewall rules. By default, sandboxes follow standard network policies, but you can restrict egress to a specific set of allowed destinations or block all outbound traffic entirely. For details on configuring network access, see network limits.
A detailed overview of the Daytona platform is available in the architecture section.
Sandbox lifecycle
Throughout its lifecycle, a sandbox can have several different states. Each state reflects the current status of your sandbox:
- Creating: the sandbox is provisioning and will be ready to use
- 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
- Deleting: the sandbox is deleting and will be removed
- Deleted: the sandbox has been deleted and no longer exists
- Archiving: the sandbox is archiving and its state will be preserved
- Archived: the sandbox has been archived and its state is preserved
- Resizing: the sandbox is being resized to a new set of resources
- Error: the sandbox is in an error state and needs to be recovered
- Restoring: the sandbox is being restored from archive and will be ready to use shortly
- Unknown: the default sandbox state before it is created
- 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
- Build Pending: the sandbox build is pending and will start shortly
- Build Failed: the sandbox build failed and needs to be retried
To view or update the current state of a sandbox, navigate to the sandbox details page or access the sandbox state attribute using the SDKs, API, or CLI.
The diagram below demonstrates the states and possible transitions between them.
Multiple runtime support
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:
pythontypescriptjavascript
If omitted, the Daytona SDK will default to python. To override this, explicitly set the language value when creating the sandbox.
For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, and API references:
CreateSandboxBaseParams.language (Python SDK)
CreateSandboxBaseParams.language (TypeScript SDK)
Create Sandboxes
Daytona provides methods to create sandboxes using the Daytona Dashboard ↗ or programmatically using the Daytona Python, TypeScript, Ruby, Go SDKs, CLI, or API.
You can specify programming language runtime, snapshots, resources, regions, environment variables, and volumes for each sandbox. Running sandboxes utilize CPU, memory, and disk storage. Every resource is charged per second of usage.
- Navigate to Daytona Sandboxes ↗
- Click the Create Sandbox button
- Enter the name of the sandbox (optional)
- Select a source for the sandbox (optional):
- Snapshot: a pre-configured sandbox template
- Image: OCI-compliant container image (public, local, private registries). Images require setting sandbox resources. Default: 1 vCPU, 1GB RAM, 3GiB disk.
- Select a region (optional): if not specified, your organization’s default region will be used
- Define sandbox lifecycle management options (optional) or set as an ephemeral sandbox
- Add environment variables in key-value pairs or import them from a
.envfile (optional) - Add labels in key-value pairs (optional)
- Select network settings (optional):
- Public HTTP preview: allow public access to HTTP preview URLs
- Block all network access: block all outbound network access
- Click the Create button to create a sandbox
from daytona import Daytona, CreateSandboxFromSnapshotParams
daytona = Daytona()
# Create a sandboxsandbox = daytona.create()
# Create a sandbox with pythonparams = CreateSandboxFromSnapshotParams(language="python")sandbox = daytona.create(params)
# Create a sandbox with a custom nameparams = CreateSandboxFromSnapshotParams(name="my_awesome_sandbox")sandbox = daytona.create(params)
# Create a sandbox with custom labelsparams = CreateSandboxFromSnapshotParams(labels={"LABEL": "label"})sandbox = daytona.create(params)import { Daytona } from '@daytona/sdk';
const daytona = new Daytona();
// Create a sandboxconst sandbox = await daytona.create();
// Create a sandbox with typescriptconst sandbox = await daytona.create({ language: 'typescript' });
// Create a sandbox with a custom nameconst sandbox = await daytona.create({ name: 'my_awesome_sandbox' });
// Create a sandbox with custom labelsconst sandbox = await daytona.create({ labels: { LABEL: 'label' } });require 'daytona'
daytona = Daytona::Daytona.new
# Create a sandboxsandbox = daytona.create
# Create a sandbox with pythonparams = Daytona::CreateSandboxFromSnapshotParams.new(language: Daytona::CodeLanguage::PYTHON)sandbox = daytona.create(params)
# Create a sandbox with custom labelsparams = Daytona::CreateSandboxFromSnapshotParams.new(labels: { 'LABEL' => 'label' })sandbox = daytona.create(params)// Create a sandboxparams := types.SnapshotParams{ SandboxBaseParams: types.SandboxBaseParams{ Language: types.CodeLanguagePython, },}sandbox, err := client.Create(ctx, params)daytona create [flags]curl 'https://app.daytona.io/api/sandbox' \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{}'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, API, and CLI references:
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.
To set custom sandbox resources (CPU, memory, and disk space), use the Resources class:
from daytona import Daytona, Resources, CreateSandboxFromImageParams, Image
daytona = Daytona()
# Create a sandbox with custom resourcesresources = Resources( cpu=2, # 2 CPU cores memory=4, # 4GB RAM disk=8, # 8GB disk space)
params = CreateSandboxFromImageParams( image=Image.debian_slim("3.12"), resources=resources)
sandbox = daytona.create(params)import { Daytona, Image } from "@daytona/sdk";
async function main() { const daytona = new Daytona();
// Create a sandbox with custom resources const sandbox = await daytona.create({ image: Image.debianSlim("3.12"), resources: { cpu: 2, // 2 CPU cores memory: 4, // 4GB RAM disk: 8, // 8GB disk space }, });}
main();require 'daytona'
daytona = Daytona::Daytona.new
# Create a sandbox with custom resourcessandbox = daytona.create( Daytona::CreateSandboxFromImageParams.new( image: Daytona::Image.debian_slim('3.12'), resources: Daytona::Resources.new( cpu: 2, # 2 CPU cores memory: 4, # 4GB RAM disk: 8 # 8GB disk space ) ))// Create a sandbox with custom resourcessandbox, err := client.Create(ctx, types.ImageParams{ Image: "python:3.11", Resources: &types.Resources{ CPU: 2, // 2 CPU cores Memory: 4, // 4GiB RAM Disk: 8, // 8GiB disk space },})# --memory is in MB; --disk is in GBdaytona create --cpu 2 --memory 4096 --disk 8curl 'https://app.daytona.io/api/sandbox' \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{ "cpu": 2, "memory": 4, "disk": 8}'All resource parameters are optional and must be integers. If not specified, Daytona will use the default values listed below.
| Resource | Unit | Default | Minimum | Maximum |
|---|---|---|---|---|
| CPU | vCPU | 1 | 1 | 4 |
| Memory | GiB | 1 | 1 | 8 |
| Disk | GiB | 3 | 1 | 10 |
Maximum values are per-sandbox limits set at the organization level. Contact support@daytona.io to increase limits.
For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references:
Ephemeral Sandboxes
Ephemeral Sandboxes are automatically deleted once they are stopped. They are useful for short-lived tasks or for testing purposes.
To create an ephemeral Sandbox, set the ephemeral parameter to True when creating a sandbox:
from daytona import Daytona, CreateSandboxFromSnapshotParams
daytona = Daytona()
# Create an ephemeral sandboxparams = CreateSandboxFromSnapshotParams( ephemeral=True, auto_stop_interval=5 # The ephemeral sandbox will be deleted after 5 minutes of inactivity)sandbox = daytona.create(params)import { Daytona } from '@daytona/sdk';
const daytona = new Daytona();
// Create an ephemeral sandboxconst sandbox = await daytona.create({ ephemeral: true, autoStopInterval: 5 // The ephemeral sandbox will be deleted after 5 minutes of inactivity});require 'daytona'
daytona = Daytona::Daytona.new
# Create an ephemeral Sandboxparams = Daytona::CreateSandboxFromSnapshotParams.new( ephemeral: true, auto_stop_interval: 5 # The ephemeral sandbox will be deleted after 5 minutes of inactivity)sandbox = daytona.create(params)// Create an ephemeral sandboxautoStopInterval := 5params := types.SnapshotParams{ SandboxBaseParams: types.SandboxBaseParams{ Language: types.CodeLanguagePython, Ephemeral: true, AutoStopInterval: &autoStopInterval, },}sandbox, err := client.Create(ctx, params)Network settings (Firewall)
Daytona Sandboxes provide configurable network firewall controls to enhance security and manage connectivity. By default, network access follows standard security policies, but you can customize network settings when creating a sandbox.
Start Sandboxes
Daytona provides options to start sandboxes in Daytona Dashboard ↗ or programmatically using the Python SDK, TypeScript SDK, Ruby SDK, CLI, and API references.
- Navigate to Daytona Sandboxes ↗
- Click the start icon (▶) next to the sandbox you want to start.
Starting sandbox with ID: <sandbox-id>sandbox = daytona.create(CreateSandboxFromSnapshotParams(language="python"))# Start Sandboxsandbox.start()const sandbox = await daytona.create({ language: 'typescript' });// Start Sandboxawait sandbox.start();sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(language: Daytona::CodeLanguage::PYTHON))# Start Sandboxsandbox.start// Start sandboxerr = sandbox.Start(ctx)daytona start [SANDBOX_ID] | [SANDBOX_NAME] [flags]curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/start' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references:
List Sandboxes
Daytona provides options to view information about sandboxes in Daytona Dashboard ↗ via the sandbox details page or programmatically using the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references.
# List all sandboxesresult = daytona.list()
# Iterate through resultsfor sandbox in result.items: print(f"Sandbox: {sandbox.id} (state: {sandbox.state})")
# List sandboxes with labels filterresult = daytona.list(labels={"env": "dev"})// List all sandboxesconst result = await daytona.list();
// Iterate through resultsfor (const sandbox of result.items) { console.log(`Sandbox: ${sandbox.id} (state: ${sandbox.state})`);}
// List sandboxes with labels filterconst filtered = await daytona.list({ 'env': 'dev' });# List all sandboxesresult = daytona.list
# Iterate through resultsresult.items.each do |sandbox| puts "Sandbox: #{sandbox.id} (state: #{sandbox.state})"end
# List sandboxes with labels filterresult = daytona.list({ 'env' => 'dev' })// List all sandboxesresult, err := client.List(ctx, nil, nil, nil)
// Iterate through resultsfor _, sandbox := range result.Items { fmt.Printf("Sandbox: %s (state: %s)\n", sandbox.Name, sandbox.State)}daytona list [flags]curl 'https://app.daytona.io/api/sandbox' \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references:
Sandbox details page
Daytona Dashboard ↗ provides a sandbox details page to view detailed information about a sandbox and interact with it directly.
- Navigate to Daytona Sandboxes ↗
- Click on a sandbox to open its details page
The sandbox details page provides a summary of the sandbox information and actions to perform on the sandbox:
- Name: the name of the sandbox
- UUID: the unique identifier of the sandbox
- State: the sandbox state with a visual indicator
- Actions: start, stop, recover, archive, delete, refresh, SSH access, screen recordings
- Region: the target region where the sandbox is running
- Snapshot: the snapshot used to create the sandbox
- Resources: allocated sandbox CPU, memory, and disk
- Lifecycle: auto-stop, auto-archive, and auto-delete intervals
- Labels: key-value pairs assigned to the sandbox
- Timestamps: when the sandbox was created and when the last event occurred
- Web terminal: an embedded web terminal session directly in the browser
- VNC: a graphical desktop session for sandboxes that have a desktop environment
- Logs: a detailed record of user and system activity for the sandbox
- Metrics: sandbox metrics data displayed as charts
- Traces: distributed traces and spans collected from the sandbox
- Spending: usage and cost over time
Stop Sandboxes
Daytona provides methods to stop sandboxes in Daytona Dashboard ↗ or programmatically using the Python SDK, TypeScript SDK, and Ruby SDK.
- Navigate to Daytona Sandboxes ↗
- Click the stop icon (⏹) next to the sandbox you want to stop.
Stopping sandbox with ID: <sandbox-id>Stopped sandboxes maintain filesystem persistence while their memory state is cleared. They incur only disk usage costs and can be started again when needed.
The stopped state should be used when a sandbox is expected to be started again soon. Otherwise, it is recommended to stop and then archive the sandbox to eliminate disk usage costs.
sandbox = daytona.create(CreateSandboxFromSnapshotParams(language="python"))
# Stop sandboxsandbox.stop()
print(sandbox.id) # 7cd11133-96c1-4cc8-9baa-c757b8f8c916
# The sandbox ID can later be used to get the sandbox and start itsandbox = daytona.get("7cd11133-96c1-4cc8-9baa-c757b8f8c916")
# Start sandboxsandbox.start()const sandbox = await daytona.create({ language: 'typescript' });
// Stop sandboxawait sandbox.stop();
console.log(sandbox.id) // 7cd11133-96c1-4cc8-9baa-c757b8f8c916
// The sandbox ID can later be used to get the sandbox and start itconst found = await daytona.get('7cd11133-96c1-4cc8-9baa-c757b8f8c916');
// Start sandboxawait found.start();sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(language: Daytona::CodeLanguage::PYTHON))
# Stop sandboxsandbox.stop
puts sandbox.id # 7cd11133-96c1-4cc8-9baa-c757b8f8c916
# The sandbox ID can later be used to find the sandbox and start itsandbox = daytona.get('7cd11133-96c1-4cc8-9baa-c757b8f8c916')
# Start sandboxsandbox.start// Stop sandboxerr = sandbox.Stop(ctx)
fmt.Println(sandbox.ID) // 7cd11133-96c1-4cc8-9baa-c757b8f8c916
// The sandbox ID can later be used to find the sandbox and start itsandbox, err = client.Get(ctx, sandbox.ID)
// Start sandboxerr = sandbox.Start(ctx)daytona stop [SANDBOX_ID] | [SANDBOX_NAME] [flags]curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/stop' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'If you need a faster shutdown, use force stop (force=true / --force) to terminate it immediately. Force stop is ungraceful and should be used when quick termination is more important than process cleanup.
Common use cases for force stop include:
- you need to reduce stop time and can accept immediate termination
- the entrypoint ignores termination signals or hangs during shutdown
Avoid force stop for normal shutdowns where the process should flush buffers, write final state, or run cleanup hooks.
For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references:
Archive Sandboxes
Daytona provides methods to archive sandboxes in Daytona Dashboard ↗ or programmatically using the Python SDK, TypeScript SDK, and Ruby SDK.
When sandboxes are archived, the entire filesystem state is moved to a cost-effective object storage, making it possible to keep sandboxes available for an extended period. Starting an archived sandbox takes more time than starting a stopped sandbox, depending on its size.
A sandbox must be stopped before it can be archived and can be started again in the same way as a stopped sandbox.
# Archive Sandboxsandbox.archive()// Archive Sandboxawait sandbox.archive();# Archive Sandboxsandbox.archive// Archive sandboxerr = 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'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references:
Recover Sandboxes
Daytona provides methods to recover sandboxes in Daytona Dashboard ↗ or programmatically using the Python SDK, TypeScript SDK, and Ruby SDK.
# Recover sandboxsandbox.recover()// Recover sandboxawait sandbox.recover();# Recover sandboxsandbox.recovercurl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/recover' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, and API references:
Recover from error state
When a sandbox enters an error state, it can sometimes be recovered using the recover method, depending on the underlying error reason. The recoverable flag indicates whether the error state can be resolved through an automated recovery procedure.
# Check if the Sandbox is recoverableif sandbox.recoverable: sandbox.recover() print("Sandbox recovered successfully")// Check if the Sandbox is recoverableif (sandbox.recoverable) { await sandbox.recover(); console.log('Sandbox recovered successfully');}# Check if the Sandbox is in an error state before recoveringif sandbox.state == 'error' sandbox.recover puts 'Sandbox recovered successfully'endcurl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/recover' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, and API references:
Resize Sandboxes
Daytona provides methods to resize sandbox resources after creation. 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.
from daytona import Daytona, Resources
daytona = Daytona()sandbox = daytona.create()
# 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()import { Daytona } from '@daytona/sdk';
const daytona = new Daytona();const sandbox = await daytona.create();
// 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();require 'daytona'
daytona = Daytona::Daytona.newsandbox = daytona.create
# 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.stopsandbox.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}'For more information, see the Python SDK, TypeScript SDK, Go SDK, Ruby SDK and API references:
Delete Sandboxes
Daytona provides methods to delete sandboxes in Daytona Dashboard ↗ or programmatically using the Python SDK, TypeScript SDK, and Ruby SDK.
- Navigate to Daytona Sandboxes ↗
- Click the Delete button next to the sandbox you want to delete.
Deleting sandbox with ID: <sandbox-id># Delete sandboxsandbox.delete()// Delete sandboxawait sandbox.delete();# Delete sandboxsandbox.delete// Delete sandboxerr = sandbox.Delete(ctx)daytona delete [SANDBOX_ID] | [SANDBOX_NAME] [flags]curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}' \ --request DELETE \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, CLI, and API references:
Automated lifecycle management
Daytona Sandboxes can be automatically stopped, archived, and deleted based on user-defined intervals.
Auto-stop interval
The auto-stop interval parameter sets the amount of time after which a running sandbox will be automatically stopped.
The auto-stop interval triggers even if there are internal processes running in the sandbox. 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.
The parameter can either be set to:
- a time interval in minutes
0: disables the auto-stop functionality, allowing the sandbox to run indefinitely
If the parameter is not set, the default interval of 15 minutes will be used.
sandbox = daytona.create(CreateSandboxFromSnapshotParams( snapshot="my-snapshot-name", # Disables the auto-stop feature - default is 15 minutes auto_stop_interval=0,))const sandbox = await daytona.create({ snapshot: "my-snapshot-name", // Disables the auto-stop feature - default is 15 minutes autoStopInterval: 0,});sandbox = daytona.create( Daytona::CreateSandboxFromSnapshotParams.new( snapshot: 'my-snapshot-name', # Disables the auto-stop feature - default is 15 minutes auto_stop_interval: 0 ))// Create a sandbox with auto-stop disabledautoStopInterval := 0params := types.SnapshotParams{ Snapshot: "my-snapshot-name", SandboxBaseParams: types.SandboxBaseParams{ AutoStopInterval: &autoStopInterval, },}sandbox, err := client.Create(ctx, params)curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autostop/{interval}' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, and API references:
set_autostop_interval (Python SDK)
What resets the timer
The inactivity timer resets only for specific external interactions:
- Updates to sandbox lifecycle states
- Network requests through sandbox previews
- Active SSH connections
- API requests to the Daytona Toolbox SDK
What does not reset the timer
The following do not reset the timer:
- SDK requests that are not toolbox actions
- Background scripts (e.g.,
npm run devrun as a fire-and-forget command) - Long-running tasks without external interaction
- Processes that don’t involve active monitoring
If you run a long-running task like LLM inference that takes more than 15 minutes to complete without any external interaction, the sandbox may auto-stop mid-process because the process itself doesn’t count as “activity”, therefore the timer is not reset.
Auto-archive interval
Daytona provides methods to set the auto-archive interval using the Python SDK, TypeScript SDK, and Ruby SDK.
The auto-archive interval parameter sets the amount of time after which a continuously stopped sandbox will be automatically archived.
The parameter can either be set to:
- a time interval in minutes
0: the maximum interval of30 dayswill be used
If the parameter is not set, the default interval of 7 days will be used.
sandbox = daytona.create(CreateSandboxFromSnapshotParams( snapshot="my-snapshot-name", # Auto-archive after a sandbox has been stopped for 1 hour auto_archive_interval=60,))const sandbox = await daytona.create({ snapshot: "my-snapshot-name", // Auto-archive after a sandbox has been stopped for 1 hour autoArchiveInterval: 60,});sandbox = daytona.create( Daytona::CreateSandboxFromSnapshotParams.new( snapshot: 'my-snapshot-name', # Auto-archive after a sandbox has been stopped for 1 hour auto_archive_interval: 60 ))// Create a sandbox with auto-archive after 1 hourautoArchiveInterval := 60params := types.SnapshotParams{ Snapshot: "my-snapshot-name", SandboxBaseParams: types.SandboxBaseParams{ AutoArchiveInterval: &autoArchiveInterval, },}sandbox, err := client.Create(ctx, params)curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autoarchive/{interval}' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, and API references:
set_auto_archive_interval (Python SDK)
setAutoArchiveInterval (TypeScript SDK)
auto_archive_interval (Ruby SDK)
Auto-delete interval
Daytona provides methods to set the auto-delete interval using the Python SDK, TypeScript SDK, and Ruby SDK.
The auto-delete interval parameter sets the amount of time after which a continuously stopped sandbox will be automatically deleted. By default, sandboxes will never be automatically deleted.
The parameter can either be set to:
- a time interval in minutes
-1: disables the auto-delete functionality0: the sandbox will be deleted immediately after stopping
If the parameter is not set, the sandbox will not be deleted automatically.
sandbox = daytona.create(CreateSandboxFromSnapshotParams( snapshot="my-snapshot-name", # Auto-delete after a sandbox has been stopped for 1 hour auto_delete_interval=60,))
# Delete the sandbox immediately after it has been stoppedsandbox.set_auto_delete_interval(0)
# Disable auto-deletionsandbox.set_auto_delete_interval(-1)const sandbox = await daytona.create({ snapshot: "my-snapshot-name", // Auto-delete after a sandbox has been stopped for 1 hour autoDeleteInterval: 60,});
// Delete the sandbox immediately after it has been stoppedawait sandbox.setAutoDeleteInterval(0)
// Disable auto-deletionawait sandbox.setAutoDeleteInterval(-1)sandbox = daytona.create( Daytona::CreateSandboxFromSnapshotParams.new( snapshot: 'my-snapshot-name', # Auto-delete after a sandbox has been stopped for 1 hour auto_delete_interval: 60 ))
# Delete the sandbox immediately after it has been stoppedsandbox.auto_delete_interval = 0
# Disable auto-deletionsandbox.auto_delete_interval = -1// Create a sandbox with auto-delete after 1 hourautoDeleteInterval := 60params := types.SnapshotParams{ Snapshot: "my-snapshot-name", SandboxBaseParams: types.SandboxBaseParams{ AutoDeleteInterval: &autoDeleteInterval, },}sandbox, err := client.Create(ctx, params)
// Delete the sandbox immediately after it has been stoppedzeroInterval := 0err = sandbox.SetAutoDeleteInterval(ctx, &zeroInterval)
// Disable auto-deletiondisableInterval := -1err = sandbox.SetAutoDeleteInterval(ctx, &disableInterval)curl 'https://app.daytona.io/api/sandbox/{sandboxIdOrName}/autodelete/{interval}' \ --request POST \ --header 'Authorization: Bearer YOUR_API_KEY'For more information, see the Python SDK, TypeScript SDK, Ruby SDK, Go SDK, and API references:
set_auto_delete_interval (Python SDK)
setAutoDeleteInterval (TypeScript SDK)
auto_delete_interval (Ruby SDK)
Running indefinitely
Daytona provides methods to run sandboxes indefinitely using the Python SDK, TypeScript SDK, and Ruby SDK.
By default, Daytona Sandboxes auto-stop after 15 minutes of inactivity. To keep a sandbox running without interruption, set the auto-stop interval to 0 when creating a new sandbox:
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 minutesautoStopInterval := 0params := types.SnapshotParams{ Snapshot: "my_awesome_snapshot", SandboxBaseParams: types.SandboxBaseParams{ AutoStopInterval: &autoStopInterval, },}sandbox, err := client.Create(ctx, params)