读取后台任务输出(扩展)
按字节偏移读取后台任务日志,不唤醒沙箱。
/agent/v1/sessions/{session_id}/background_tasks/{task_id}/output● 支持请求参数
session_idstring必填path: 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_idstring必填path: Background task id (task_...), as listed by sessions.background_tasks.list.
offsetinteger可选query: 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_bytesinteger可选query: Maximum number of bytes to return: an integer from 1 to 262144, default 65536.
返回
200
offset 默认 0;max_bytes 默认 65536,上限 262144。返回 text、next_offset、eof。沙箱已暂停或不存在时返回空 text、原 offset、eof=true、unavailable=true。读取不确认模型结果。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
响应
HTTP 200
Background task output byte page
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| 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. |