Skip to content
中文

Read a range of a task's pushed output

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

GET/sandbox/v1/sandboxes/{sandboxID}/tasks/{taskID}/log● Supported

Request parameters

  • sandboxIDstringrequired

    path: Sandbox ID.

  • taskIDstringrequired

    path: Task id returned by sandboxes.tasks.start; a task id is opaque and is not the sandbox id.

  • namestringoptional

    query: Which stream to read: output is the task's own stdout and stderr and is the default; any other value must be one of the file names passed to sandboxes.tasks.start. 1 to 32 characters of a-z, 0-9 or a hyphen.

  • offsetintegeroptional

    query: First byte of the range, counted from the start of the stream. Omit to start at 0; resume with the previous answer's nextOffset.

  • limitintegeroptional

    query: How many bytes to return, at most 4 MiB; omit for 1 MiB. A smaller limit follows a running task with less data per call.

Returns

200

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/tsk_example/log \
  -H "X-API-Key: $PRAXIS_API_KEY"
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.get(
    "https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/tasks/tsk_example/log",
    headers={"X-API-Key": api_key},
)
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/tsk_example/log`, {
  headers: { "X-API-Key": apiKey },
});
console.log(resp.status, await resp.text());

Response 200

{
  "text": "hello from a task\n",
  "nextOffset": 18,
  "done": true,
  "exitCode": 0,
  "size": 18
}

Response

HTTP 200

The requested range, and where to continue

application/json

Name Type Description
text string The requested bytes decoded as UTF-8, backing up to a whole character when the range would split one. Concatenate successive pages; a page never ends mid-character.
nextOffset integer Byte offset to pass as offset on the next call. It advances past what text delivered, so repeating a page is not needed; when done is true it equals size.
done boolean True once the task's final marker exists and the whole stream has been read. Only then are exitCode and size the task's outcome; false means more may still arrive, not that the task failed.
exitCode integer | null The task's exit status, from the final marker: 0 for success, non-zero for failure, null while the task has not finished. It is how the task ended, not how one page was read.
size integer | null Total bytes the stream will hold, from the final marker; null while the task runs and the total is not yet known. It is the bound for offset, and equals nextOffset when done.