DaytonaDocs

Python SDK

Install and configure rlp-sdk.

The Python SDK is published on PyPI 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. It requires Python 3.9+ and has a single runtime dependency (httpx).

Install

The current version is 0.2.0. Install the latest, or pin a version for reproducible builds:

Python
pip install rlp-sdk
# or
uv pip install rlp-sdk
 
# pin a specific version
pip install "rlp-sdk==0.2.0"

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_url → RLP_API_URL → DAYTONA_API_URL
api_keystr— (required)config.api_key → RLP_API_KEY → DAYTONA_API_KEY
toolbox_urlstrNoneconfig.toolbox_url → RLP_TOOLBOX_URL → the sandbox DTO's toolboxProxyUrl
targetstr"local"config.target → RLP_TARGET → DAYTONA_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