DaytonaDocs

Python SDK

Install and configure rlp-sdk.

The Python SDK is published as rlp-sdk and imported as the rlp module. It mirrors the official Daytona SDK's Python surface (class names, method names, error types), so most Daytona code ports by changing the import.

Install

Python
pip install rlp-sdk
# or
uv pip install rlp-sdk

Configure

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

Python
from rlp import Daytona, DaytonaConfig
 
# Explicit configuration
daytona = Daytona(DaytonaConfig(
    api_url="https://api.example.com",
    api_key="rlp_...",
    toolbox_url="https://proxy.example.com/toolbox",
))
 
# Or rely entirely on environment variables
daytona = Daytona()
FieldTypeDefaultResolution order
api_urlstr— (required)config.api_urlRLP_API_URLDAYTONA_API_URL
api_keystr— (required)config.api_keyRLP_API_KEYDAYTONA_API_KEY
toolbox_urlstrNoneconfig.toolbox_urlRLP_TOOLBOX_URL → the sandbox DTO's toolboxProxyUrl
targetstr"local"config.targetRLP_TARGETDAYTONA_TARGET"local"

Constructing the client raises 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 raise DaytonaValidationError at that point.

Quick example

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

Python
from rlp import Daytona, CreateSandboxFromImageParams
 
daytona = Daytona()
 
sandbox = daytona.create(CreateSandboxFromImageParams(image="python:3.12-slim"))
try:
    result = sandbox.process.exec("python3 -c 'print(6 * 7)'")
    print(result.exit_code)  # 0
    print(result.result)     # 42
finally:
    sandbox.delete()

See the quickstart for a longer walkthrough.

Reference pages

On this page