读取输出
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
GET
/sandbox/v1/sandboxes/{sandboxID}/processes/{processID}/output● 支持请求参数
sandboxIDstring必填path: 沙箱 ID。
processIDstring必填path: 从进程列表取得的 processId。
返回
200
错误按 E2B 格式返回,参见 错误码
请求示例
curl
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
curl https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/processes/proc_123/output \
-H "X-API-Key: $PRAXIS_API_KEY"Python
# 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
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/processes/proc_123/output",
headers={"X-API-Key": api_key},
)
print(resp.status_code, resp.text)TypeScript
// 先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
const apiKey = "$PRAXIS_API_KEY";
// Call /sandbox/v1 directly over HTTP.
const resp = await fetch(`https://api.deepraxis.com/sandbox/v1/sandboxes/sbx_123/processes/proc_123/output`, {
headers: { "X-API-Key": apiKey },
});
console.log(resp.status, await resp.text());响应示例 200
{
"chunks": [
{
"seq": 1,
"stream": "stdout",
"data": "ZG9jcyBzYW1wbGUK",
"timestamp": 1792719486403
}
],
"truncated": false,
"complete": true,
"gap": false,
"exitCode": 0
}响应
HTTP 200
Bounded observation with explicit completeness
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| chunks | array<object> | Retained output chunks of the process, oldest first. |
| chunks[].seq | integer | Sequence number of the chunk; it increases with time and orders chunks. |
| chunks[].stream | string | Which stream the chunk came from. |
| chunks[].data | string | Output bytes of the chunk, base64 encoded. |
| chunks[].timestamp | number | Time at which the chunk was recorded, in Unix milliseconds. |
| complete | boolean | True when the output is whole: the exit was witnessed, no gap occurred and nothing was truncated. |
| gap | boolean | True when observation was interrupted, so chunks or the exit may be missing. |
| truncated | boolean | True when old chunks were dropped to stay within the retention limits. |
| exitCode | integer | null | Exit code of the process; null until an exit was witnessed. |