Agent

Get Session Compaction (Extension)

Read session compaction status by operation ID.

Call Create session first and replace the example session ID with its returned ID.

GET /agent/v1/sessions/{session_id}/compact/{operation_id}● 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.

  • operation_idstring必填

    path: Compaction operation id returned by sessions.compact in the id field of the session_compaction object.

Returns

200

Available only on /agent/v1. Returns { type: session_compaction, id, status, reason? } with HTTP 200 for every status. A missing operation or inaccessible session returns 404 not_found_error.

Errors follow the Anthropic error format (type / message / request_id) — see error codes

Response

HTTP 200

Compaction operation

application/json

NameTypeDescription
typestringAlways `session_compaction`. Result of a compaction request.
idstringCompaction operation id; pass it as operation_id to sessions.compact.retrieve.
statusstringState of the compaction operation: queued and running are in progress, skipped means nothing needed compaction, succeeded and failed are final.
reasonstringWhy the compaction was skipped or failed; absent otherwise.