DaytonaDocs

Daytona (client)

The top-level client — sandbox CRUD and service accessors.

Daytona is the top-level client exported by @rlp/sdk. It owns sandbox create/get/list/delete, delegates lifecycle helpers to Sandbox, and exposes the resource services as readonly properties. Construct it with an optional config object — configuration and environment-variable fallbacks are covered on the TypeScript SDK page.

TypeScript
import { Daytona } from '@rlp/sdk'
 
const daytona = new Daytona()

Services

PropertyServiceManages
daytona.snapshotSnapshotServiceImage aliases and Dockerfile builds
daytona.volumeVolumeServicePersistent volumes
daytona.objectStoreObjectStoreServiceS3-compatible bucket mounts
daytona.secretSecretServiceProject-scoped secrets
daytona.fnFunctionServiceManaged serverless functions

create()

Creates a sandbox and resolves once it reaches the started state. Creation is asynchronous server-side, so the client polls the sandbox until it is running (or errors, or the timeout elapses). Exactly one image source is required: snapshot (a snapshot name) or image (a registry ref).

TypeScript
create(
  params?: CreateSandboxFromSnapshotParams | CreateSandboxFromImageParams,
  options?: { timeout?: number },
): Promise<Sandbox>
ParameterTypeDefaultDescription
paramsCreateSandboxFromSnapshotParams | CreateSandboxFromImageParams{}Sandbox parameters; see the table below.
options.timeoutnumber60Seconds to wait for started. 0 waits indefinitely.

Both params types share these fields (plus snapshot?: string or image: string respectively):

FieldTypeDefaultDescription
namestringOptional sandbox name.
envVarsRecord<string, string>Environment variables injected with their real values. Names must match [A-Za-z_][A-Za-z0-9_]*.
labelsRecord<string, string>Key/value labels (see the note below).
resourcesResourcescpu (may be fractional), gpu, memory (GiB), disk (GiB).
mode'burstable' | 'dedicated'Scheduling mode; burstable is the platform default.
portsPortRequest[]Ports to expose: { vmPort, proto?: 'tcp' | 'udp' }.
dockerDataMibnumberSize of a dedicated /var/lib/docker device, in MiB.
volumesVolumeMount[]Persistent volumes to attach.
objectStoreMountsObjectStoreMount[]Object stores to FUSE-mount.
secretsstring[]Names of project secrets to attach.
persistentbooleanPersistent write layer — enables warm stop()/start(), pause()/resume(), fork().
spotbooleanSpot tier: discounted but reclaimable.

Returns: a started Sandbox.

Throws: DaytonaValidationError if neither snapshot nor image is set, or the timeout is negative; DaytonaTimeoutError if the sandbox is not started in time; DaytonaError if the sandbox lands in the error state.

Note: resources.memory, resources.disk, and labels are sent by the SDK but not applied by the API yet — only resources.cpu maps today. Use the REST API's mem_mib / scratch_mib to size memory and disk; region is also REST-only. See sandbox parameters.

TypeScript
const sandbox = await daytona.create({
  image: 'node:22-slim',
  resources: { cpu: 0.5 },
  ports: [{ vmPort: 3000 }],
  persistent: true,
})

get()

Fetches a single sandbox by its id or name and returns a hydrated handle.

TypeScript
get(idOrName: string): Promise<Sandbox>

Returns: a Sandbox. Throws: DaytonaNotFoundError if no sandbox matches.

TypeScript
const sandbox = await daytona.get('my-sandbox')
console.log(sandbox.state)

list()

Lists the project's sandboxes, optionally filtered client-side by id prefix, name prefix, and count.

TypeScript
list(query?: ListSandboxesQuery): Promise<Sandbox[]>
ParameterTypeDefaultDescription
query.idstringKeep sandboxes whose id starts with this prefix.
query.namestringKeep sandboxes whose name starts with this prefix.
query.limitnumberTruncate the result to at most this many sandboxes.

Returns: an array of Sandbox handles.

TypeScript
const sandboxes = await daytona.list({ name: 'build-', limit: 10 })
for (const sb of sandboxes) console.log(sb.id, sb.state)

Lifecycle helpers

Each helper simply delegates to the same-named method on the sandbox handle — see Sandbox for full semantics, including which operations require a persistent sandbox.

TypeScript
start(sandbox: Sandbox, timeout?: number): Promise<void>   // warm-start a stopped persistent sandbox
stop(sandbox: Sandbox): Promise<void>                      // warm-stop (persistent only)
pause(sandbox: Sandbox): Promise<void>                     // memory-preserving pause (persistent only)
resume(sandbox: Sandbox, timeout?: number): Promise<void>  // resume a paused sandbox
delete(sandbox: Sandbox): Promise<void>                    // delete any sandbox
TypeScript
await daytona.stop(sandbox)   // later...
await daytona.start(sandbox)  // warm start on any capable runner
await daytona.delete(sandbox)

See stop & start and pause & resume for lifecycle guides.

On this page