Get Background Task Output (Extension)
/agent/v1/sessions/{session_id}/background_tasks/{task_id}/output● SupportedRequest parameters
session_idstringrequiredpath: Session id (sesn_...), as returned by sessions.create or sessions.list. The same id is also accepted as the session_id query parameter on resource and thread calls, where it must equal the path value.
task_idstringrequiredpath: Background task id (task_...), as listed by sessions.background_tasks.list.
offsetintegeroptionalquery: Byte offset into the task output to read from; start at 0 and continue with the next_offset of the previous response. Integer of at least 0, default 0.
max_bytesintegeroptionalquery: Maximum number of bytes to return: an integer from 1 to 262144, default 65536.
Returns
200
Own-face extension. offset defaults to 0; max_bytes defaults to 65536 and must be between 1 and 262144. Returns text, next_offset and eof. Offsets count UTF-8 bytes, not characters; partial trailing characters are retained for the next read. eof describes the current log, which may grow while running. A paused or missing sandbox returns empty text, the original offset, eof=true and unavailable=true, without waking it. Reading does not acknowledge model result delivery. Missing or inaccessible sessions or tasks return 404; invalid ranges return 400.
Errors follow the Anthropic error format (type / message / request_id) — see error codes
Request
curl
curl "https://api.deepraxis.com/agent/v1/sessions/sesn_example/background_tasks/task_example/output?offset=0&max_bytes=65536" \
-H "Authorization: Bearer $PRAXIS_API_KEY"Python
import requests
opts = dict(
base_url="https://api.deepraxis.com/agent",
api_key="$PRAXIS_API_KEY",
)
# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
f"{opts['base_url']}/v1/sessions/sesn_example/background_tasks/task_example/output?offset=0&max_bytes=65536",
headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())TypeScript
const opts = {
baseURL: "https://api.deepraxis.com/agent",
apiKey: "$PRAXIS_API_KEY",
};
// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions/sesn_example/background_tasks/task_example/output?offset=0&max_bytes=65536`, {
headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());Response 200
{
"text": "Build complete.\n",
"next_offset": 16,
"eof": true
}Response
HTTP 200
Background task output byte page
application/json
| Name | Type | Description |
|---|---|---|
| text | string | Text of the block. |
| next_offset | integer | Byte offset to pass as offset to continue reading the output. |
| eof | boolean | True when the output has ended and no more bytes will follow. |
| unavailable | boolean | True when the output could not be read; text is then empty. |