DaytonaDocs

Daytona (client)

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

Daytona is the top-level client exported by rlpsdk. 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 'rlpsdk'
 
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
namestring—Optional 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).
resourcesResources—cpu (fractional floor in burstable, min 0.125; whole cores in dedicated), gpu (number of GPUs to attach — see GPU sandboxes), memory (GiB), disk (GiB).
mode'burstable' | 'dedicated'—Scheduling mode; burstable is the platform default.
portsPortRequest[]—Ports to expose: { vmPort, proto?: 'tcp' | 'udp' }.
dockerDataMibnumber—Size 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.
persistentboolean—Persistent write layer — enables warm stop()/start(), pause()/resume(), fork().
spotboolean—Spot tier: discounted but reclaimable.
egressPolicyEgressPolicy—Outbound network allow-list (since 0.2.0): { enabled, allow } where allow is an array of IPs, CIDRs, and/or domains.
cpuArch'amd64' | 'arm64'—CPU architecture; amd64 is the default. See Architecture support.
cpuTypestring—Pin to a minimum CPU hardware tier by slug (e.g. 'graviton'; list them via GET /cpu-types). Implies its architecture. Placement uses the tier as a floor — it may run on a higher tier of the same architecture, never a lower one.
networkClassstring—Pin to a minimum NIC class by slug (e.g. '100g'; list them via GET /network-classes). Runs on that class or higher. Not supported with GPU or Windows sandboxes.
diskClassstring—Pin to a minimum NVMe class by slug (e.g. 'nvme-gen5'; list them via GET /disk-classes). Runs on that class or higher. Not supported with GPU or Windows sandboxes.

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 and resources.gpu map 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,
  egressPolicy: { enabled: true, allow: ['api.openai.com'] },
})

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.idstring—Keep sandboxes whose id starts with this prefix.
query.namestring—Keep sandboxes whose name starts with this prefix.
query.limitnumber—Truncate 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