List Session Background Tasks (Extension)
List running and ended background tasks for a session.
/agent/v1/sessions/{session_id}/background_tasks● SupportedRequest 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.
Returns
200
Own-face extension. Returns { data: BackgroundTask[] }. Each task has id, kind, title, thread_id, status, started_at, ended_at, cancellable, notified_at and trigger_count. Subagent rows link to their child thread via thread_id; other kinds have null. kind is an open string; tolerate unknown kinds. Status is running, result_pending, completed, failed, cancelled or lost. Only completed tasks with pending delivery are result_pending. Timestamps are RFC3339; ended_at is null while running. notified_at is the admission time of the latest system notification batch, or null. trigger_count counts admitted monitor event batches, or is null without records and for other kinds. Only supported running tasks without stop intent are cancellable. Missing or inaccessible sessions return 404.
Errors follow the Anthropic error format (type / message / request_id) — see error codes
Response
HTTP 200
Session background tasks
application/json
| Name | Type | Description |
|---|---|---|
| data | array<object> | Items of this page, in the order requested by the call. |
| data[].id | string | Identifier of the object, as returned by the API; pass it in the path of follow-up calls on the same resource. |
| data[].kind | string | Kind of background task: bash for a command started with run_in_background, monitor for a Monitor watch. |
| data[].title | string | Short human-readable title of the task or object. |
| data[].thread_id | string | null | Execution thread the task belongs to; null for the primary thread. |
| data[].status | string | Current lifecycle state. |
| data[].started_at | string | RFC 3339 time at which the task started. |
| data[].ended_at | string | null | RFC 3339 time at which the task ended; null while it is running. |
| data[].cancellable | boolean | Whether the task can still be stopped. |
| data[].notified_at | string | null | RFC 3339 time of the latest run that the task's notification started; null while no notification has been delivered. |
| data[].trigger_count | integer | null | For a monitor task, how many times its matches woke the session; null for other kinds or before the first notification. |