Linux Sandboxes
Linux virtual machine sandboxes, their capabilities, use cases, and architecture.
Linux sandboxes are Linux virtual machines (VMs). Each sandbox is a virtual machine, a microVM, that runs its own Linux kernel on shared physical hardware and has its own operating system, files, network connection, and fixed amount of processor, memory, and disk. The hardware enforces the boundary and isolation between sandboxes.
| Term | Description |
|---|---|
| Sandbox | An isolated Linux machine created on demand to run code. |
| Host | The physical server that runs many sandboxes at once. Daytona calls these servers runners. |
| Guest | The operating system running inside a sandbox, as opposed to the operating system of the host. |
| Kernel | The core of an operating system. It manages memory, processes, files, and devices. |
| Hypervisor | Software on the host that creates virtual machines and keeps them separated from each other and from the host. |
| Image | A packaged filesystem, such as python:3.12-slim, that defines what software a sandbox starts with. |
| Snapshot | A saved copy of a sandbox's memory and disk that new sandboxes resume from. |
Use cases
Sandboxes are used wherever code must run in a real environment, but you cannot trust the code or you cannot afford for it to affect anything else.
- Code execution for AI agents: an agent writes code, runs it in a sandbox, reads the output, and decides what to do next. The sandbox gives the agent a real shell and filesystem while keeping its actions away from your infrastructure.
- Coding agents: an agent clones a repository, installs dependencies, edits files, runs the test suite, and opens a pull request, all inside one sandbox.
- Reinforcement learning (RL): training runs create very large numbers of identical environments, run one episode in each, score the result, and discard the environment. Fast creation from a shared snapshot keeps the cost of each environment low.
- Evaluation and benchmarks: each test case or model run gets a clean, identical machine, so results do not depend on leftover state from a previous run.
- Code interpreters and data analysis: a chat application runs user or model-generated Python against uploaded files and returns tables, charts, and results.
- Untrusted user code: online coding platforms, grading systems, and plugin hosts run code submitted by users without exposing other users or the service.
- Computer-use agents: an agent operates a graphical desktop, a browser, or desktop applications through screenshots and input events.
- Development environments: a developer gets a preconfigured machine from an image, connects over SSH or from an editor, and previews web applications through a URL.
Create a Linux sandbox
Create a Linux sandbox from the dashboard or programmatically.
- Go to Daytona Sandboxes ↗
- Click Create
- Select Linux sandbox
- Click Create
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create()The following example sets the remaining parameters:
from daytona import Daytona
from daytona.v2 import PortRequest, VolumeMount
daytona = Daytona()
volume = daytona.v2.volume.get("my-volume")
sandbox = daytona.v2.create(
name="my-sandbox",
labels={"team": "research", "run": "42"},
cpu=2,
memory=4,
disk=20,
ports=[PortRequest(vm_port=8080), PortRequest(vm_port=5353, proto="udp")],
network_policy={"block_all": True, "allow_domains": ["pypi.org", "*.github.com"]},
volumes=[VolumeMount(volume_id=volume.id, mount_path="/data", subpath="runs/42")],
env={"LOG_LEVEL": "debug"},
secrets=["GITHUB_TOKEN"],
persistent=True,
spot=False,
region="us",
cpu_arch="amd64",
cpu_type="zen5",
lifecycle={
"idle_timeout_secs": 3600,
"on_idle_timeout": "pause",
"wake_on_request": True,
"timeout_secs": 604800,
"on_timeout": "delete",
},
idempotency_key="run-42-create",
wait=120,
)| Parameter | Type | Description |
|---|---|---|
image | str | Sets the registered image that the sandbox starts from, by name or img_ ID. This is the first positional argument and is required. |
name | str | Sets the display name. If omitted, a name is generated. Within one workload cell, a create with the same name and different arguments is refused until the first sandbox is deleted. |
labels | Dict[str, str] | Attaches key-value metadata to the sandbox. |
cpu | float | Sets the guaranteed CPU cores as a float. The value is raised to at least one core per 4 GiB of guaranteed memory. The default is 0.125. |
memory | int | Sets the guaranteed memory in GiB. The default is 1 GiB. |
disk | int | Sets the guaranteed writable disk in GiB. The default is 512 MiB. |
resources | Resources | Sets CPU, memory, and disk in one object, in place of cpu, memory, and disk. It also carries cpu_max, the vCPU limit, which defaults to 16, and memory_max, the memory limit in GiB, which defaults to 32. |
ports | Sequence[PortRequest] | Forwards inbound ports to the sandbox. |
volumes | Sequence[VolumeMount] | Mounts persistent volumes in the sandbox. |
env | Dict[str, str] | Sets environment variables inside the sandbox. |
secrets | Sequence[str] | Attaches project secrets by name. The sandbox sees each secret as an opaque placeholder. |
network_policy | NetworkPolicyInput | Sets the outbound network policy with block_all, allow_domains, and allow_cidrs. You can change it after create. |
persistent | bool | Adds a durable write layer, which enables stop and start, pause and resume, and fork. The default is False. |
spot | bool | Runs the sandbox on discounted capacity that can be reclaimed. The default is False. |
region | str | Sets the region or global region slug. The default is the project default. |
cpu_arch | str | Sets the CPU architecture, amd64 or arm64. The default is amd64. |
cpu_type | str | Sets the CPU hardware tier slug: zen3, zen4, zen5, zen5c, arrowlake1, arrowlake2, graviton, graviton3, and graviton4. The slug also sets the architecture. See CPU types. |
lifecycle | LifecycleConfig | Sets the lifecycle policy with timeout_secs and on_timeout, idle_timeout_secs and on_idle_timeout, and wake_on_request. Each action is stop, pause, or delete, and stop and pause need persistent. By default, there is no idle timeout, and the wall-clock timeout uses the organization or platform default, if one is enabled. |
idempotency_key | str | Makes a retried create in the same workload cell return the same sandbox. A create in another cell makes a separate sandbox. To keep creates in one region, set region. If name is set, the key is derived from it. Otherwise, each call generates a new key. |
wait | int | Sets how many seconds create waits for the sandbox to start. The server holds the request for up to 3 seconds, and the SDK waits for the rest. 0 returns immediately. The default is 60. If the sandbox has not started in time, or fails, create() returns it without raising. Check sandbox.state before using it. |
CPU types
A CPU type is a processor model that a Linux sandbox can request when it is created. Each type belongs to one architecture, amd64 or arm64, and has a tier: its rank within that architecture, starting at 1 for the lowest. Requesting a CPU type also sets the sandbox's architecture.
The CPU type list contains every type that a create request accepts, whether or not a runner provides it. To see which types a region can serve, add the region. A type is available in a region when a running runner there provides it. When no runner provides the type itself, a runner with a higher tier of the same architecture can serve it as a fallback. Availability reflects the runners that are live at request time. List regions gives the region slugs.
# List CPU types
daytona cpu-type list
# Check CPU type availability in a region
daytona cpu-type list --region us-west-1| Flag | Type | Description |
|---|---|---|
--region | string | Sets one region slug. Without it, the command lists CPU types without availability. With it, the table output adds an AVAILABLE column. The column shows exact if a runner in the region provides the type, fallback if a higher tier of the same architecture serves it, and - otherwise. |
Disk and network classes
A disk class is the tier of a host's local NVMe storage, and a network class is the tier of its network interface. Each class has a tier: its rank within its dimension, starting at 1 for the lowest. A create request cannot select a class. A new sandbox runs on hosts with its region's default classes, a fork keeps the classes of its source, and a persistent sandbox keeps its own classes when it starts again.
Each list contains the classes that hosts advertise and regions default to.
# List disk classes
daytona disk-class list
# List network classes
daytona network-class listLifecycle
Every Linux sandbox moves through a lifecycle. A Linux sandbox can have several different states. Each state reflects the status of your sandbox. A Linux sandbox transitions between states in response to user actions, or automatically when one of its timeouts elapses.
| Feature | Persistent | Ephemeral |
|---|---|---|
| Stop and start | ✓ | ✗ |
| Pause and resume | ✓ | ✗ |
| Fork | ✓ | ✗ |
| Delete | ✓ | ✓ |
| Filesystem persistence | ✓ | ✗ |
| Memory persistence | ✓ | ✗ |
| Memory snapshot | ✓ | ✗ |
| Filesystem snapshot | ✓ | ✓ |
| Spot (Preemption) | ✓ | ✓ |
| Network policy | ✓ | ✓ |
| Desktop | ✓ | ✓ |
Every Linux sandbox supports wait for state, delete, timeouts, and lifecycle policy updates. Stop and start, pause and resume, fork, auto-stop, and auto-pause require a persistent sandbox. A persistent Linux sandbox keeps its filesystem across stop and start and across host failure. It keeps its memory and running processes across pause and resume, and in forks. An ephemeral Linux sandbox keeps its filesystem and memory until it is deleted.
| State | Description |
|---|---|
queued | The create request is recorded and waits to be published for placement. |
pending | The create request is accepted and the sandbox is queued for placement. |
assigned | The sandbox is placed on a host. A start or resume also re-enters this state. |
booting | The microVM is booting and will be ready to use. |
running | The sandbox is running and ready to accept requests. |
stopping | The sandbox is stopping and no longer accepts requests. |
stopped | The sandbox is stopped. Compute is released and the filesystem is kept on durable storage. |
pausing | The sandbox is pausing while its memory and vCPU state are captured. |
paused | The sandbox is paused with filesystem, memory, and process state preserved. |
deleting | The sandbox is being deleted. |
deleted | The sandbox and its ephemeral storage are removed. |
failed | The sandbox could not boot or hit an unrecoverable error. |
lost | The host running an ephemeral sandbox was lost. A persistent sandbox on a lost host becomes stopped instead. |
| Initial state | Target state | Trigger |
|---|---|---|
queued | pending | The create request is published for placement. |
pending | assigned | The sandbox is placed on a host. |
pending | paused | A fork of a running or paused sandbox completes and the new sandbox holds the captured memory. |
pending | stopped | A fork of a stopped sandbox completes and the new sandbox holds the copied filesystem. |
assigned | booting | The host prepares the sandbox image and the microVM boots. |
booting | running | The sandbox finishes booting and accepts requests. |
running | stopping | A stop is requested on a persistent sandbox, or the platform reclaims a persistent spot sandbox that has volumes attached. |
stopping | stopped | The shutdown completes. The filesystem is kept and memory state is cleared. |
stopped | assigned | A start is requested and the sandbox is placed again, possibly on different hardware. |
running | pausing | A pause is requested on a persistent sandbox, or the platform reclaims a persistent spot sandbox. |
pausing | paused | The filesystem, memory, and running processes are preserved. |
paused | assigned | A resume is requested and memory is restored, or a start is requested and the sandbox cold-boots from its filesystem. |
| any state | deleting | A delete is requested, or the platform reclaims an ephemeral spot sandbox. |
deleting | deleted | The sandbox is removed and its resources are released. |
| any active state | failed | The sandbox fails to boot or hits an unrecoverable error. |
running | stopped | The host running a persistent sandbox is lost. |
running | lost | The host running an ephemeral sandbox is lost. |
Wait for state
Wait until a Linux sandbox reaches a target state. The wait stops early when the sandbox reaches a state from which the target is no longer reachable, such as failed or deleted. The SDKs use their own state names, so the SDK started state corresponds to the running state in the CLI and API.
# Block until the sandbox is started; returns the sandbox
sandbox.wait(until="started", timeout=60)
# Block until the sandbox is stopped or paused
sandbox.wait_for_state(["stopped", "paused"], timeout=60)| Parameter | Type | Description |
|---|---|---|
until | str | Sets the one state that wait() waits for. wait_for_state() takes a list and returns on any of its states. The default is "started". |
timeout | float | Sets the wait limit in seconds. None or 0 waits without a limit. When the timeout elapses, both methods raise RequestTimeoutError. The default is 60 for wait() and None for wait_for_state(). |
Stop / start
Stop and start a persistent Linux sandbox. Stopping shuts down the virtual machine and keeps the filesystem. Memory state is cleared. While a stop is in progress, the sandbox is in the stopping state and does not accept new requests. Starting boots the sandbox from its preserved filesystem, possibly on a different host. To keep running processes without consuming CPU, pause the sandbox instead.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(persistent=True)
# Stop shuts down the VM; the filesystem is kept and memory is cleared
sandbox.stop()
sandbox.wait_for_state(["stopped"], timeout=60)
# Start boots the sandbox from its preserved filesystem
sandbox.start()Pause / resume
Pause and resume a persistent Linux sandbox. Pausing keeps the filesystem and memory state, and the sandbox no longer consumes CPU. While a pause is in progress, the sandbox is in the pausing state. Resuming restores memory and continues all processes from the point they were frozen. Daytona also pauses a persistent spot sandbox when it reclaims the capacity, or stops it when it has volumes attached.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(persistent=True)
# Pause freezes the sandbox with filesystem and memory intact
sandbox.pause()
sandbox.wait_for_state(["paused"], timeout=60)
# Resume continues all processes from the point they were frozen
sandbox.resume()Fork
Fork a persistent Linux sandbox to copy its filesystem and memory state into a new, independent sandbox. A fork of a running sandbox starts running. A fork of a paused sandbox stays paused with the captured memory. A fork of a stopped sandbox copies only the filesystem and stays stopped. You can start, stop, and delete the fork without affecting the original.
Daytona records the source of each fork, so you can trace a fork back to the sandbox it was created from. You can fork a fork to build branches. Deleting the source sandbox does not affect its forks.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(persistent=True)
forked = sandbox.fork(name="my-sandbox-fork")| Parameter | Type | Description |
|---|---|---|
name | str | Sets the name of the fork. The default is the source name with a -fork suffix. |
memory | bool | Copies the memory and running processes. False copies only the filesystem, and the fork boots fresh. A stopped source is always forked without memory. The default is True. |
Delete
Delete a Linux sandbox to tear down its virtual machine. Deletion works in any state, and the call returns once teardown starts. The sandbox moves from deleting to deleted when the teardown finishes. Daytona discards the sandbox's filesystem and memory, including the filesystem of a persistent sandbox. Images and snapshots captured from the sandbox remain, and forks of the sandbox are not affected.
Before Daytona detaches the sandbox's disk volumes, it runs a final commit on them, and the volumes keep their data.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create()
sandbox.delete()Timeouts
Daytona stops, pauses, or deletes a Linux sandbox automatically when one of its two timers elapses. Each timer pairs an interval in seconds with the action it fires. Set both timers at create in the lifecycle object, and change them later through update lifecycle policy.
| Timer | Purpose | Fires after | Default |
|---|---|---|---|
| Timeout | Cap how long a sandbox runs | The sandbox has been running for the interval, active or not | Project or platform default |
| Idle timeout | Stop, pause, or delete a sandbox that is not in use | The sandbox has had no activity for the interval | Project default, or off |
The valid actions depend on whether the sandbox is persistent and apply to both timers. Delete is valid for every Linux sandbox:
| Action | Ephemeral (default) | Persistent |
|---|---|---|
| Stop | ✗ | ✓ |
| Pause | ✗ | ✓ |
| Delete | ✓ | ✓ |
Auto-stop, auto-pause, and auto-delete are not separate settings. Each one is the idle timeout with the matching action.
Wake on request starts a stopped persistent sandbox, or resumes a paused one, when a request arrives for it through the Daytona proxy. Wake on request does not wake a sandbox whose delete timeout has elapsed.
Timeout
The timeout is a wall-clock budget. It starts when the sandbox is created and re-arms with the full budget every time the sandbox enters running: on start, resume, and wake. Activity does not extend it. A delete timeout fires in any state. A stop or pause timeout fires only while the sandbox is running. Once set, the timeout cannot be cleared.
When the timeout is omitted at create, Daytona applies the project's lifecycle defaults. Without a project default, Daytona applies the platform default timeout of 300 seconds, if the platform default is enabled. An explicit timeout must not exceed the organization maximum, 86,400 seconds (24 hours) unless the organization sets a different maximum.
When the action is omitted, it defaults to pause for persistent Linux sandboxes and delete for ephemeral Linux sandboxes.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(
# Delete the sandbox 2 hours after it last entered running
lifecycle={"timeout_secs": 7200, "on_timeout": "delete"},
)Idle timeout
The idle timeout fires after the sandbox has had no activity for the interval. Activity is any request through the toolbox API, preview URLs, VNC, and SSH, a toolbox command that is still running, and any lifecycle operation on the sandbox. The idle timeout is off by default unless the project sets one, has a minimum of 60 seconds, and requires an action. An idle stop or pause fires only while the sandbox is running. The action fires within about 2 minutes after the interval elapses.
Auto-stop
Stop a persistent Linux sandbox after a period of inactivity.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(
persistent=True,
lifecycle={"idle_timeout_secs": 900, "on_idle_timeout": "stop"},
)Auto-pause
Pause a persistent Linux sandbox after a period of inactivity. With wake on request, the next request through the Daytona proxy resumes it.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(
persistent=True,
lifecycle={"idle_timeout_secs": 3600, "on_idle_timeout": "pause", "wake_on_request": True},
)Auto-delete
Delete a Linux sandbox after a period of inactivity.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(
lifecycle={"idle_timeout_secs": 3600, "on_idle_timeout": "delete"},
)Reset the idle timer
Reset the idle timer of a Linux sandbox to keep it alive while it does work that Daytona does not count as activity. The reset counts as activity, so the idle countdown restarts from now. The timeout is not affected.
The reset succeeds in any state, whether or not an idle timeout is set. It never moves the timer backwards: when newer activity arrives at the same time, the newer activity wins.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create(
lifecycle={"idle_timeout_secs": 3600, "on_idle_timeout": "delete"},
)
lifecycle = sandbox.reset_idle_timer()
print(lifecycle.idle_timeout_at)Update lifecycle policy
Update the timeouts of an existing Linux sandbox. Omitted fields keep their current values. The new actions must be valid for the sandbox, as listed in timeouts.
from daytona import Daytona
from daytona.v2 import DISABLED
daytona = Daytona()
sandbox = daytona.v2.create(persistent=True)
# Pause the sandbox after 30 minutes without activity and wake it on request; omitted fields keep their current value
lifecycle = sandbox.set_lifecycle(idle_timeout_secs=1800, on_idle_timeout="pause", wake_on_request=True)
print(lifecycle.idle_timeout_secs, lifecycle.on_idle_timeout)
# Re-anchor the timeout to 1 hour from now
lifecycle = sandbox.set_lifecycle(timeout_secs=3600)
print(lifecycle.timeout_at)
# Clear the idle timeout
lifecycle = sandbox.set_lifecycle(idle_timeout_secs=DISABLED)Filesystem persistence
Filesystem persistence keeps the contents of a sandbox's disk: installed packages, cloned repositories, build artifacts, and the files the sandbox writes. A sandbox with a preserved filesystem starts with its environment intact, with nothing to reinstall or rebuild.
Linux sandboxes are ephemeral by default. An ephemeral Linux sandbox keeps its writable disk on the host's local storage. Deleting the sandbox discards the disk, and a host failure loses the sandbox. A persistent Linux sandbox keeps its writable disk on network storage that any host in the region can attach. Stop releases compute and keeps the filesystem, and start boots the sandbox again, possibly on another host. A host failure leaves a persistent sandbox stopped instead of lost.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create("python-3.12", persistent=True)
# Write state to the filesystem
sandbox.process.run("pip install requests && echo done > /root/setup.log")
# Stop releases compute; the filesystem stays on network storage
sandbox.stop()
sandbox.wait_for_state(["stopped"], timeout=60)
# Start boots the sandbox again, possibly on another host
sandbox.start()
response = sandbox.process.run("cat /root/setup.log")
print(response.stdout) # done| Parameter | Type | Description |
|---|---|---|
persistent | bool | Keeps the writable disk on network storage, which enables stop and start, pause and resume, and fork. The default is False. |
Memory persistence
Memory persistence keeps the runtime state of a sandbox: running processes, open connections, and everything loaded in memory. A sandbox with preserved memory continues from the point it was frozen, instead of starting from a clean boot.
A persistent Linux sandbox keeps its memory across pause and resume. Pause freezes the sandbox in place, and the sandbox no longer consumes CPU. Resume continues every process from the point it was frozen. A fork copies the filesystem and memory into a new, independent sandbox.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create("python-3.12", persistent=True)
# Start a process that holds state in memory
sandbox.process.start("python3 -m http.server 8000")
# Pause freezes the sandbox with its filesystem and memory
sandbox.pause()
# Resume continues every process from the point it was frozen
sandbox.resume()
response = sandbox.process.run("curl -s -o /dev/null -w '%{http_code}' http://localhost:8000")
print(response.stdout) # 200: the server is still runningMemory snapshot
A memory snapshot saves the memory and disk of a running Linux sandbox under a name. A sandbox restored from the snapshot resumes the captured processes and memory instead of booting. The restored sandbox gets the CPU, memory, and disk of the source sandbox. Deleting the source sandbox does not delete its snapshots.
The capture runs in the background: the snapshot starts as pending and becomes ready when the capture finishes. A snapshot restores only in the region of its source sandbox, on the host that captured it, and the restore fails while that host is unavailable.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create("python-3.12", persistent=True)
# Capture the memory and disk of the running sandbox
snapshot = sandbox.create_snapshot("my-snapshot")
# Block until the capture is ready
snapshot = daytona.v2.snapshots.get(snapshot.id, wait="ready", timeout=60)
# Resume the captured processes and memory in a new sandbox
restored = daytona.v2.create_from_snapshot("my-snapshot")| Parameter | Type | Description |
|---|---|---|
name | str | Sets the snapshot name, 1 to 128 characters of letters, digits, ., _, and -. Snapshots and images in the project share one name space. A name in use fails with 409. This parameter is required. |
snapshot | str | Sets the snapshot that create_from_snapshot() restores from, by name or by ID, snap_.... This parameter is required. |
Filesystem snapshot
A filesystem snapshot saves the filesystem of a running Linux sandbox as an image. The sandbox keeps running, and new sandboxes boot from the image with the captured files. Unlike a memory snapshot, a filesystem snapshot holds no processes or memory. Ephemeral and persistent Linux sandboxes can both be captured.
The capture runs in the background: the image starts as pending and becomes ready when the capture finishes. A named image is permanent until you delete it. An unnamed image is anonymous. Daytona deletes an anonymous image after its idle window passes without a sandbox create from it. The idle window is the server maximum of 7 days by default.
from daytona import Daytona
daytona = Daytona()
sandbox = daytona.v2.create("python-3.12")
sandbox.process.run("pip install requests")
# Capture the filesystem; the sandbox keeps running
image = sandbox.snapshot_filesystem(name="my-env")
# Wait until the capture is ready, then boot new sandboxes from it
while image.status not in ("ready", "failed"):
image = daytona.v2.images.get(image.id, wait="ready")
if image.status == "failed":
raise RuntimeError(image.error)
clone = daytona.v2.create("my-env")| Parameter | Type | Description |
|---|---|---|
name | str | Sets the image name, which must be unique in the project. The default is None, which makes the image anonymous. |
idle | int | Sets how many seconds an anonymous image can go without a sandbox create before deletion. It applies only to anonymous images. -1 sets the maximum. The default is the server maximum. |
Spot
Linux sandboxes run on reserved capacity by default. A spot Linux sandbox runs on discounted capacity that Daytona can reclaim at any time to free resources for full-price sandboxes. Spot multiplies the CPU, memory, and disk price by 0.7. Apart from price and reclaim, a spot Linux sandbox supports the same images, resources, volumes, and lifecycle operations as any other Linux sandbox.
A reclaim is immediate, with no advance notice and no grace period. The outcome depends on whether the sandbox is persistent:
| Sandbox | On reclaim |
|---|---|
| Ephemeral | Moves to deleting, then deleted. Only data on a volume remains. |
| Persistent | Moves to pausing, then paused, with the filesystem, memory, and running processes kept. |
| Persistent with an attached volume | Moves to stopping, then stopped, with the filesystem kept and memory cleared. |
Daytona does not bring a reclaimed sandbox back on its own. A reclaimed sandbox carries the reclaim time in spot_evicted_at until it is started or resumed. To continue, resume a paused sandbox or start a stopped one. The sandbox stays spot and can be reclaimed again.
from daytona import Daytona
daytona = Daytona()
# A persistent spot sandbox is paused on reclaim instead of deleted
sandbox = daytona.v2.create("python-3.12", spot=True, persistent=True)
# spot_evicted_at is None unless Daytona reclaimed the sandbox
sandbox = daytona.v2.get(sandbox.id)
if sandbox.spot_evicted_at:
# Start resumes a paused sandbox or starts a stopped one
sandbox.start()| Parameter | Type | Description |
|---|---|---|
spot | bool | Places the sandbox on discounted, reclaimable capacity. The default is False. |