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.
Services
| Property | Service | Manages |
|---|---|---|
daytona.snapshot | SnapshotService | Image aliases and Dockerfile builds |
daytona.volume | VolumeService | Persistent volumes |
daytona.objectStore | ObjectStoreService | S3-compatible bucket mounts |
daytona.secret | SecretService | Project-scoped secrets |
daytona.fn | FunctionService | Managed 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).
| Parameter | Type | Default | Description |
|---|---|---|---|
params | CreateSandboxFromSnapshotParams | CreateSandboxFromImageParams | {} | Sandbox parameters; see the table below. |
options.timeout | number | 60 | Seconds to wait for started. 0 waits indefinitely. |
Both params types share these fields (plus snapshot?: string or image: string respectively):
| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | Optional sandbox name. |
envVars | Record<string, string> | — | Environment variables injected with their real values. Names must match [A-Za-z_][A-Za-z0-9_]*. |
labels | Record<string, string> | — | Key/value labels (see the note below). |
resources | Resources | — | cpu (may be fractional), gpu, memory (GiB), disk (GiB). |
mode | 'burstable' | 'dedicated' | — | Scheduling mode; burstable is the platform default. |
ports | PortRequest[] | — | Ports to expose: { vmPort, proto?: 'tcp' | 'udp' }. |
dockerDataMib | number | — | Size of a dedicated /var/lib/docker device, in MiB. |
volumes | VolumeMount[] | — | Persistent volumes to attach. |
objectStoreMounts | ObjectStoreMount[] | — | Object stores to FUSE-mount. |
secrets | string[] | — | Names of project secrets to attach. |
persistent | boolean | — | Persistent write layer — enables warm stop()/start(), pause()/resume(), fork(). |
spot | boolean | — | Spot 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, andlabelsare sent by the SDK but not applied by the API yet — onlyresources.cpumaps today. Use the REST API'smem_mib/scratch_mibto size memory and disk;regionis also REST-only. See sandbox parameters.
get()
Fetches a single sandbox by its id or name and returns a hydrated handle.
Returns: a Sandbox. Throws: DaytonaNotFoundError if no sandbox matches.
list()
Lists the project's sandboxes, optionally filtered client-side by id prefix, name prefix, and count.
| Parameter | Type | Default | Description |
|---|---|---|---|
query.id | string | — | Keep sandboxes whose id starts with this prefix. |
query.name | string | — | Keep sandboxes whose name starts with this prefix. |
query.limit | number | — | Truncate the result to at most this many sandboxes. |
Returns: an array of Sandbox handles.
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.
See stop & start and pause & resume for lifecycle guides.