Skip to content

Daytona

Execute code in isolated sandbox environments

The Create Repository Sandbox component creates a new Daytona sandbox, clones a repository, and runs a bootstrap script.

  • Ephemeral dev environments: Spin up a fresh environment for a repository on demand
  • CI-like workflows: Clone code and run setup scripts before downstream tasks
  • Automated validation: Prepare repository state before executing tests or commands
  • The component waits for the sandbox to reach the “started” state
  • Clone and bootstrap run sequentially in the same session
  • If clone or bootstrap fails, the component returns an error
{
"data": {
"bootstrap": {
"from": "file",
"path": "scripts/bootstrap.sh"
},
"directory": "/home/daytona/example-app",
"repository": "https://github.com/superplanehq/example-app.git",
"sandboxId": "sandbox-abc123def456",
"sandboxStartedAt": "2026-01-19T12:00:00Z",
"secrets": [
{
"name": "API_KEY",
"type": "env",
"value": {
"key": "API_KEY",
"secret": "api-key-secret"
}
}
],
"timeout": 300
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "daytona.repository.sandbox"
}

The Create Sandbox component creates an isolated environment for executing code safely.

  • AI code execution: Run AI-generated code in a secure sandbox
  • Code testing: Test untrusted code without affecting your infrastructure
  • Development environments: Create ephemeral development environments
  • Snapshot: Base environment snapshot (optional, uses default if not specified)
  • Target: Target region for the sandbox (optional)
  • Auto Stop Interval: Time in minutes before the sandbox auto-stops
  • Environment Variables: Key-value pairs to set as environment variables in the sandbox

Returns the sandbox information including:

  • id: The unique sandbox identifier (use this in subsequent execute/delete operations)
  • state: The current state of the sandbox (e.g., “started”)
  • The component polls the sandbox state until it reaches “started”
  • Each sandbox is fully isolated
  • Remember to delete sandboxes when done to free resources
{
"data": {
"id": "sandbox-abc123def456",
"state": "started"
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "daytona.sandbox"
}

The Delete Sandbox component removes an existing Daytona sandbox.

  • Resource cleanup: Delete sandboxes after code execution is complete
  • Cost management: Remove unused sandboxes to free resources
  • Workflow cleanup: Clean up sandboxes at the end of automation workflows
  • Sandbox: The ID or name of the sandbox to delete (from createSandbox output)
  • Force: Optional flag to force deletion even if sandbox is running

Returns deletion confirmation including:

  • deleted: Boolean indicating successful deletion
  • id: The ID of the deleted sandbox
  • Always delete sandboxes when they are no longer needed
  • Sandboxes will auto-stop after the configured interval, but explicit deletion frees resources immediately
{
"data": {
"deleted": true,
"id": "sandbox-abc123def456"
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "daytona.delete.response"
}

The Execute Code component runs code in an existing Daytona sandbox.

  • AI code execution: Run AI-generated code safely
  • Code testing: Execute untrusted code in isolation
  • Script automation: Run Python, TypeScript, or JavaScript scripts
  • Data processing: Execute data transformation scripts
  • Sandbox: The sandbox ID to execute code in (from createSandbox output). Supports expressions, e.g. {{ $["daytona.createSandbox"].data.id }}
  • Code: The code to execute (supports expressions)
  • Language: The programming language (python, typescript, javascript)
  • Timeout: Optional execution timeout in milliseconds

Returns the execution result including:

  • exitCode: The process exit code (0 for success)
  • result: The stdout/output from the code execution
  • The sandbox must be created first using createSandbox
  • Code output is captured from stdout
  • Non-zero exit codes indicate execution errors
{
"data": {
"exitCode": 0,
"result": "Hello, World!\n"
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "daytona.execute.response"
}

The Execute Command component runs shell commands in an existing Daytona sandbox.

  • Package installation: Install dependencies (pip install, npm install)
  • File operations: Create, move, or delete files in the sandbox
  • System commands: Run any shell command in the isolated environment
  • Build processes: Execute build scripts or compilation commands
  • Sandbox: The sandbox ID to run commands in (from createSandbox output). Supports expressions, e.g. {{ $["daytona.createSandbox"].data.id }}
  • Command: The shell command to execute
  • Working Directory: Optional working directory for the command
  • Environment Variables: Optional key-value pairs exported before command execution
  • Timeout: Optional execution timeout in seconds

Routes to one of two channels:

  • success: Exit code is 0
  • failed: Exit code is non-zero

The payload includes:

  • exitCode: The process exit code (0 for success)
  • timeout: Whether the command timed out
  • result: The stdout/output from the command execution
  • The sandbox must be created first using createSandbox
  • Commands run in a shell environment
  • Non-zero exit codes indicate command failures
{
"data": {
"exitCode": 0,
"result": "Successfully installed requests-2.31.0\n",
"timeout": false
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "daytona.command.response"
}

The Get Preview URL component generates a Daytona preview URL for a specific sandbox port.

  • Open sandbox web apps: Access a web app running in a sandbox from a browser
  • Share previews: Generate signed URLs that can be opened without custom headers
  • Automation: Generate preview links for downstream steps and notifications
  • Sandbox: Sandbox to generate the preview URL for
  • Port: Sandbox port to preview (default: 3000)
  • Signed URL: Whether to generate a signed preview URL (default: true)
  • Expires In Seconds: Signed URL expiration in seconds (default: 60, max: 86400)
  • Standard URL (signed=false): https://{port}-{sandboxId}.{daytonaProxyDomain} Requires x-daytona-preview-token header with the returned token
  • Signed URL (signed=true): https://{port}-{token}.{daytonaProxyDomain} Authentication is embedded in the URL, no custom header required

Returns preview URL information including:

  • sandbox: The sandbox ID used in the request
  • port: The target sandbox port
  • signed: Whether the generated URL is signed
  • url: Generated preview URL
  • token: Preview token (embedded token for signed URLs, header token for standard URLs)
  • expiresInSeconds: Expiration for signed URLs
  • The target port must be serving HTTP traffic in the sandbox, otherwise preview access may fail
  • Signed URLs can be opened directly in browsers
  • Standard URLs require x-daytona-preview-token header for private sandboxes
{
"data": {
"expiresInSeconds": 3600,
"port": 3000,
"sandbox": "sandbox-abc123def456",
"signed": true,
"token": "signed-token-abc123",
"url": "https://3000-signed-token-abc123.preview.daytona.app"
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "daytona.preview.response"
}