Daytona icon

Daytona

Manage Daytona sandboxes, snapshots, and volumes; run code and shell commands; drive a full Git pipeline; and manage the sandbox filesystem

Code → Run Code

AI-generated

Summary

Execute user-provided Python, JavaScript, or TypeScript code inside a Daytona sandbox, optionally using a temporary ephemeral sandbox for isolated execution.

Inputs

  • Code (required) — The source code string to execute inside the sandbox.
  • Language (required) — The programming language/runtime to execute the code with (Python, JavaScript, or TypeScript).
  • Use Ephemeral Sandbox (required) — Boolean to create a temporary sandbox for this execution that is automatically deleted afterward. If false, an existing sandbox ID must be provided.
  • Sandbox ID — ID of an existing sandbox where the code will run. Required if not using an ephemeral sandbox.
  • Snapshot — Snapshot ID or name to base the ephemeral sandbox on; defaults to the organization's default snapshot if empty.
  • Additional Fields — Optional extra parameters including:
  • Argv: space-separated command-line arguments passed to the script.
  • Environment Variables: list of name/value pairs to set in the sandbox environment.
  • Timeout (Seconds): max time to wait for code execution.
  • Wait Until Started Timeout (Seconds): max time to wait for ephemeral sandbox start before running code.

Output shape

a JSON object with the code execution results per input item.

Returns JSON containing: exitCode (script exit code), result (script output as string, empty if none), artifacts (optional additional data from execution), sandboxId used, ephemeral flag indicating if sandbox was temporary, and a cleanupWarning if ephemeral sandbox deletion failed. Supports multiple input items; output is an array of JSON objects paired to corresponding inputs.

Examples

Example 1: Run Python code in a new ephemeral sandbox

Set Code to the Python script text, Language to 'Python', and keep Use Ephemeral Sandbox enabled.

Example 2: Run TypeScript code in an existing sandbox

Set Code to the TypeScript code, Language to 'TypeScript', disable Use Ephemeral Sandbox, and specify the existing Sandbox ID.

Links

Discussion