DaytonaDocs

TypeScript SDK

Install and configure @rlp/sdk.

The TypeScript SDK is published as @rlp/sdk. It mirrors the official Daytona SDK's TypeScript surface (class names, method names, error types), so most Daytona code ports by changing the import. All methods are async and fully typed.

Install

TypeScript
npm install @rlp/sdk

Configure

Construct a Daytona client with an optional config object. Every field falls back to environment variables — an explicit config value wins, then RLP_*, then DAYTONA_* where a fallback exists.

TypeScript
import { Daytona } from '@rlp/sdk'
 
// Explicit configuration
const daytona = new Daytona({
  apiUrl: 'https://api.example.com',
  apiKey: 'rlp_...',
  toolboxUrl: 'https://proxy.example.com/toolbox',
})
 
// Or rely entirely on environment variables
const daytona = new Daytona()
FieldTypeDefaultResolution order
apiUrlstring— (required)config.apiUrlRLP_API_URLDAYTONA_API_URL
apiKeystring— (required)config.apiKeyRLP_API_KEYDAYTONA_API_KEY
toolboxUrlstringundefinedconfig.toolboxUrlRLP_TOOLBOX_URL → the sandbox DTO's toolboxProxyUrl
targetstring'local'config.targetRLP_TARGETDAYTONA_TARGET'local'

The constructor throws DaytonaValidationError if no API URL can be resolved, and DaytonaAuthenticationError if no API key can be resolved. If no toolbox URL is available from any source, sandbox operations that need it throw DaytonaValidationError at that point. API keys are covered under Authentication.

Quick example

Create a sandbox, run a command in it, then delete it:

TypeScript
import { Daytona } from '@rlp/sdk'
 
const daytona = new Daytona()
 
const sandbox = await daytona.create({ image: 'node:22-slim' })
try {
  const result = await sandbox.process.executeCommand('node -e "console.log(6 * 7)"')
  console.log(result.exitCode) // 0
  console.log(result.result)   // 42
} finally {
  await sandbox.delete()
}

See the quickstart for a longer walkthrough.

Reference pages

On this page