Skip to content
中文

Start a task whose output is pushed off the machine while it runs

Call Create sandbox first and replace sbx_123 with its returned sandboxID.

POST/sandbox/v1/sandboxes/{sandboxID}/tasks● Supported

Request parameters

  • sandboxIDstringrequired

    path: Sandbox ID.

  • commandstringrequired

    The shell command to run. It is handed to the sandbox's daemon in an environment variable, never in argv, so it stays out of the machine's process list; at most 64 KiB of UTF-8.

  • cwdstringoptional

    Absolute working directory inside the sandbox. Omit to run where the daemon starts; a relative path is rejected rather than resolved against a home directory you did not choose.

  • maxLifetimeSecsintegeroptional

    How long the task may run, in seconds; omit for 7200, the ceiling is 86400 (a day). The pushing credential lives 30 minutes past this, so the daemon can still deliver a task that ran to its limit.

  • filesarrayoptional

    Up to eight extra files to ship alongside the task's own output, for example a structured events log the task appends to. Each gets its own stream, read with name on sandboxes.tasks.log.

    Expand sub-fields (2)
    • namestringrequired

      Stream name this file is pushed under, 1 to 32 characters of a-z, 0-9 or a hyphen. output is reserved for the task's own stdout and stderr; read either with sandboxes.tasks.log.

    • pathstringrequired

      Absolute path of the file inside the sandbox. It is read as the task runs; a file the task has not created yet is delivered empty rather than refused.

Returns

201

Errors follow the E2B format — see error codes

Request

curl
# Call Create sandbox first and replace sbx_123 with its returned sandboxID.
curl https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/tasks \
  -H "X-API-Key: $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command":"echo hello from a task","maxLifetimeSecs":600}'
Python
# Call Create sandbox first and replace sbx_123 with its returned sandboxID.
import requests

api_key = "$PRAXIS_API_KEY"

# Call /sandbox/v1 directly over HTTP.
resp = requests.post(
    "https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/tasks",
    headers={"X-API-Key": api_key},
    json={"command": "echo hello from a task", "maxLifetimeSecs": 600},
)
print(resp.status_code, resp.text)
TypeScript
// Call Create sandbox first and replace sbx_123 with its returned sandboxID.
const apiKey = "$PRAXIS_API_KEY";

// Call /sandbox/v1 directly over HTTP.
const resp = await fetch(`https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/tasks`, {
  method: "POST",
  headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
  body: JSON.stringify({ command: "echo hello from a task", maxLifetimeSecs: 600 }),
});
console.log(resp.status, await resp.text());

Response 201

{
  "taskId": "tsk_3ijfghmiarjrjkwinlj2",
  "instanceId": "sbi_ef9aee4cfb08f8d13808bf5e",
  "startedAt": 1794264183922
}

Response

HTTP 201

The task started; its log is read with sandboxes.tasks.log

application/json

Name Type Description
taskId string Task identifier, opaque and not the sandbox id. It is the address of the pushed log: pass it to sandboxes.tasks.log, and it stays valid after the sandbox is deleted.
instanceId string The sandbox the task runs on, in the same internal spelling the request used.
startedAt integer When the task started, in Unix milliseconds. Compare against log timestamps; it is not the sandbox's creation time.