# Daytona (/integrations/daytona)

Use [Daytona](https://www.daytona.io/) in Sim to create and manage sandboxes, execute shell commands or Python, JavaScript, and TypeScript code, transfer files, and clone repositories. Authenticate with a Daytona API key. Stop or delete sandboxes when work finishes, and configure auto-stop and auto-delete intervals to manage idle resources.

## Use the block \[#usage-instructions]

Run AI-generated code in isolated sandboxes. Create and manage sandboxes, execute shell commands, run Python, JavaScript, or TypeScript code, transfer files, and clone Git repositories.

## Actions \[#actions]

### Daytona Create Sandbox \[#daytona-create-sandbox]

Create a new Daytona sandbox for running AI-generated code in isolation

#### Input \[#input]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `snapshot` | string | No | ID or name of the snapshot to create the sandbox from (uses default if empty) |
| `name` | string | No | Name for the sandbox (defaults to the sandbox ID) |
| `target` | string | No | Region where the sandbox will be created (e.g., us, eu) |
| `user` | string | No | User associated with the sandbox |
| `env` | json | No | Environment variables to set in the sandbox as key-value pairs |
| `labels` | json | No | Labels to attach to the sandbox as key-value pairs |
| `cpu` | number | No | CPU cores to allocate to the sandbox |
| `memory` | number | No | Memory to allocate to the sandbox in GB |
| `disk` | number | No | Disk space to allocate to the sandbox in GB |
| `autoStopInterval` | number | No | Auto-stop interval in minutes (0 disables auto-stop) |
| `autoArchiveInterval` | number | No | Auto-archive interval in minutes (0 uses the maximum interval) |
| `autoDeleteInterval` | number | No | Auto-delete interval in minutes (negative disables, 0 deletes immediately on stop) |
| `public` | boolean | No | Whether the sandbox HTTP preview is publicly accessible |

#### Output \[#output]

| Parameter | Type | Description |
| - | - | - |
| `sandbox` | json | The created sandbox |

### Daytona List Sandboxes \[#daytona-list-sandboxes]

List Daytona sandboxes in the organization

#### Input \[#input-1]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `limit` | number | No | Maximum number of sandboxes to return (1-200) |
| `name` | string | No | Filter sandboxes by name prefix (case-insensitive) |
| `labels` | json | No | Filter sandboxes by labels as key-value pairs |
| `cursor` | string | No | Pagination cursor from a previous response |

#### Output \[#output-1]

| Parameter | Type | Description |
| - | - | - |
| `sandboxes` | array | Sandboxes in the organization |
| `nextCursor` | string | Cursor for the next page of results |

### Daytona Get Sandbox \[#daytona-get-sandbox]

Get details of a Daytona sandbox

#### Input \[#input-2]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID or name of the sandbox |

#### Output \[#output-2]

| Parameter | Type | Description |
| - | - | - |
| `sandbox` | json | The sandbox details |

### Daytona Start Sandbox \[#daytona-start-sandbox]

Start a stopped Daytona sandbox

#### Input \[#input-3]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID or name of the sandbox |

#### Output \[#output-3]

| Parameter | Type | Description |
| - | - | - |
| `sandbox` | json | The started sandbox |

### Daytona Stop Sandbox \[#daytona-stop-sandbox]

Stop a running Daytona sandbox

#### Input \[#input-4]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID or name of the sandbox |

#### Output \[#output-4]

| Parameter | Type | Description |
| - | - | - |
| `sandbox` | json | The stopped sandbox |

### Daytona Delete Sandbox \[#daytona-delete-sandbox]

Delete a Daytona sandbox

#### Input \[#input-5]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID or name of the sandbox |

#### Output \[#output-5]

| Parameter | Type | Description |
| - | - | - |
| `sandbox` | json | The deleted sandbox |

### Daytona Execute Command \[#daytona-execute-command]

Execute a shell command inside a Daytona sandbox

#### Input \[#input-6]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID of the sandbox to execute the command in |
| `command` | string | Yes | Shell command to execute |
| `cwd` | string | No | Working directory for the command (defaults to the sandbox working directory) |
| `env` | json | No | Environment variables to set for the command as key-value pairs |
| `timeout` | number | No | Timeout in seconds (defaults to 10 seconds) |

#### Output \[#output-6]

| Parameter | Type | Description |
| - | - | - |
| `exitCode` | number | Exit code of the command (-1 if missing from the response) |
| `result` | string | Combined stdout/stderr output of the command |

### Daytona Run Code \[#daytona-run-code]

Run Python, JavaScript, or TypeScript code inside a Daytona sandbox

#### Input \[#input-7]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID of the sandbox to run the code in |
| `code` | string | Yes | Code to run |
| `language` | string | Yes | Language of the code: python, javascript, or typescript |
| `env` | json | No | Environment variables to set for the run as key-value pairs |
| `timeout` | number | No | Timeout in seconds (defaults to 10 seconds) |

#### Output \[#output-7]

| Parameter | Type | Description |
| - | - | - |
| `exitCode` | number | Exit code of the code run (-1 if missing from the response) |
| `result` | string | Combined stdout/stderr output of the code run |
| `artifacts` | json | Artifacts produced by the run (e.g., matplotlib charts) |

### Daytona Upload File \[#daytona-upload-file]

Upload a file to a Daytona sandbox

#### Input \[#input-8]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID of the sandbox to upload the file to |
| `destinationPath` | string | Yes | Destination path in the sandbox (a trailing slash uploads into that directory using the file name) |
| `file` | file | No | The file to upload |
| `fileName` | string | No | Optional file name override |

#### Output \[#output-8]

| Parameter | Type | Description |
| - | - | - |
| `uploadedPath` | string | Path of the uploaded file in the sandbox |
| `name` | string | Name of the uploaded file |
| `size` | number | Size of the uploaded file in bytes |

### Daytona Download File \[#daytona-download-file]

Download a file from a Daytona sandbox

#### Input \[#input-9]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID of the sandbox to download the file from |
| `filePath` | string | Yes | Path of the file in the sandbox |

#### Output \[#output-9]

| Parameter | Type | Description |
| - | - | - |
| `file` | file | Downloaded file stored in execution files |
| `name` | string | Name of the downloaded file |
| `mimeType` | string | MIME type of the downloaded file |
| `size` | number | Size of the downloaded file in bytes |

### Daytona List Files \[#daytona-list-files]

List files in a directory of a Daytona sandbox

#### Input \[#input-10]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID of the sandbox to list files in |
| `path` | string | No | Directory path to list (defaults to the sandbox working directory) |

#### Output \[#output-10]

| Parameter | Type | Description |
| - | - | - |
| `files` | array | Files and directories at the given path |
| ↳ `name` | string | File or directory name |
| ↳ `isDir` | boolean | Whether the entry is a directory |
| ↳ `size` | number | Size in bytes |
| ↳ `mode` | string | File mode string |
| ↳ `permissions` | string | Permission string |
| ↳ `owner` | string | Owning user |
| ↳ `group` | string | Owning group |
| ↳ `modifiedAt` | string | Last modification timestamp |

### Daytona Git Clone \[#daytona-git-clone]

Clone a Git repository into a Daytona sandbox

#### Input \[#input-11]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `sandboxId` | string | Yes | ID of the sandbox to clone the repository into |
| `url` | string | Yes | URL of the Git repository to clone |
| `path` | string | Yes | Path in the sandbox to clone the repository into |
| `branch` | string | No | Branch to clone (defaults to the default branch) |
| `commitId` | string | No | Specific commit to check out after cloning |
| `username` | string | No | Username for authenticating to private repositories |
| `password` | string | No | Password or personal access token for private repositories |

#### Output \[#output-11]

| Parameter | Type | Description |
| - | - | - |
| `repoUrl` | string | URL of the cloned repository |
| `clonePath` | string | Path the repository was cloned into |
