ByteChef LogoByteChef

Daytona

Daytona provides secure and elastic infrastructure for running AI-generated code in isolated sandboxes.

Categories: Developer Tools, Artificial Intelligence

Type: daytona/v1


Connections

Version: 1

Bearer Token

Properties

NameLabelTypeDescriptionRequired
tokenAPI KeySTRINGYour Daytona API key.true
baseUrlBase URLSTRINGThe Daytona API base URL. Change only for self-hosted deployments.true

Connection Setup

  1. Sign in to the Daytona Dashboard and open the Keys page.
  2. Click Create Key.
  3. Enter a name for the key (e.g., ByteChef), set its expiration date, and select the write:sandboxes and delete:sandboxes permissions.
  4. Click Create and copy the key.
  5. In ByteChef, create a Daytona connection and paste the key into API Key.
  6. Leave Base URL set to https://app.daytona.io/api unless you run a self-hosted Daytona deployment, in which case enter its API URL.

Actions

Execute Code

Name: executeCode

Generates and runs code in a secure, isolated Daytona sandbox and returns its output. Use this to execute AI-generated code (data analysis, calculations, scripts) safely and get the result back.

Properties

NameLabelTypeDescriptionRequired
languageLanguageSTRING
Options python, typescript, javascript, bash
The programming language of the code to execute.true
codeCodeSTRINGThe source code to execute in the sandbox.true
sandboxIdSandbox IDSTRINGRun in an existing sandbox to preserve state across turns. Leave empty to create a fresh, ephemeral sandbox for this run. A reused sandbox is never deleted by this action.false
keepSandboxKeep SandboxBOOLEAN
Options true, false
When creating a new sandbox, keep it alive after the run (instead of deleting it) so it can be reused via its returned Sandbox ID. Ignored when a Sandbox ID is supplied.false
timeoutTimeoutINTEGERMaximum time in seconds to wait for the code to finish executing.false

Example JSON Structure

{
  "label" : "Execute Code",
  "name" : "executeCode",
  "parameters" : {
    "language" : "",
    "code" : "",
    "sandboxId" : "",
    "keepSandbox" : false,
    "timeout" : 1
  },
  "type" : "daytona/v1/executeCode"
}

Output

Type: OBJECT

Properties

NameTypeDescription
exitCodeINTEGERThe exit code of the executed code (0 indicates success).
stdoutSTRINGThe standard output produced by the code.
successBOOLEAN
Options true, false
Whether the code finished with a zero exit code.
sandboxIdSTRINGThe sandbox the code ran in (reuse it to preserve state).
chartsARRAY
Items []
Chart artifacts (e.g. matplotlib) captured during execution, if any.

Output Example

{
  "exitCode" : 1,
  "stdout" : "",
  "success" : false,
  "sandboxId" : "",
  "charts" : [ ]
}

Create Sandbox

Name: createSandbox

Creates a persistent, isolated Daytona sandbox and returns its ID. Reuse the ID across executeCode and uploadFile calls to preserve state, then delete it with deleteSandbox when done.

Properties

NameLabelTypeDescriptionRequired
languageLanguageSTRING
Options python, typescript, javascript, bash
The default language runtime for the sandbox.false

Example JSON Structure

{
  "label" : "Create Sandbox",
  "name" : "createSandbox",
  "parameters" : {
    "language" : ""
  },
  "type" : "daytona/v1/createSandbox"
}

Output

Type: OBJECT

Properties

NameTypeDescription
sandboxIdSTRINGThe ID of the created sandbox.

Output Example

{
  "sandboxId" : ""
}

Delete Sandbox

Name: deleteSandbox

Deletes a Daytona sandbox and frees its resources.

Properties

NameLabelTypeDescriptionRequired
sandboxIdSandbox IDSTRINGThe ID of the sandbox to delete.true

Example JSON Structure

{
  "label" : "Delete Sandbox",
  "name" : "deleteSandbox",
  "parameters" : {
    "sandboxId" : ""
  },
  "type" : "daytona/v1/deleteSandbox"
}

Output

Type: OBJECT

Properties

NameTypeDescription
deletedBOOLEAN
Options true, false
Whether the sandbox was deleted.

Output Example

{
  "deleted" : false
}

Upload File

Name: uploadFile

Uploads a file into a Daytona sandbox at the given path.

Properties

NameLabelTypeDescriptionRequired
sandboxIdSandbox IDSTRINGThe ID of the sandbox to upload the file into.true
pathPathSTRINGThe absolute destination path inside the sandbox (e.g. /home/daytona/data.csv).true
fileFileFILE_ENTRYThe file to upload.true

Example JSON Structure

{
  "label" : "Upload File",
  "name" : "uploadFile",
  "parameters" : {
    "sandboxId" : "",
    "path" : "",
    "file" : {
      "extension" : "",
      "mimeType" : "",
      "name" : "",
      "url" : ""
    }
  },
  "type" : "daytona/v1/uploadFile"
}

Output

Type: OBJECT

Properties

NameTypeDescription
pathSTRINGThe destination path the file was uploaded to.

Output Example

{
  "path" : ""
}

Additional Instructions

Running code from an AI Agent

Execute Code is also available as a tool for the AI Agent. Add it under the agent's tools, and the agent can write code (Python, TypeScript, JavaScript or Bash), run it in an isolated Daytona sandbox, and use the output in its answer. This is useful for data analysis, calculations and scripts that the model should not try to compute in its head.

The tool returns exitCode, stdout, success, sandboxId and any charts the code produced (for example, matplotlib plots).

Sandbox lifecycle

By default, Execute Code creates a new sandbox, runs the code and deletes the sandbox when the run finishes, so nothing carries over between runs.

To keep files, installed packages and variables between runs:

  1. Create a sandbox with Create Sandbox, or run Execute Code with Keep Sandbox enabled. Both return a sandboxId.
  2. Pass that sandboxId to later Execute Code and Upload File calls. A sandbox passed in this way is never deleted by Execute Code.
  3. Delete the sandbox with Delete Sandbox when you are done. Sandboxes you keep count against your Daytona usage until you delete them.

How is this guide?

Last updated on

On this page