Agent

Get Background Task Output (Extension)

Read a byte page of task output without waking the sandbox.

GET /agent/v1/sessions/{session_id}/background_tasks/{task_id}/output● Supported

Request parameters

  • 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可选
    默认 0

    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可选
    默认 65536

    query: 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

Response

HTTP 200

Background task output byte page

application/json

NameTypeDescription
textstringText of the block.
next_offsetintegerByte offset to pass as offset to continue reading the output.
eofbooleanTrue when the output has ended and no more bytes will follow.
unavailablebooleanTrue when the output could not be read; text is then empty.