tasks
Creates, updates, deletes, gets or lists a tasks resource.
Overview
| Name | tasks |
| Type | Resource |
| Id | github.agent_tasks.tasks |
Fields
The following fields are returned by SELECT queries:
- get_task_by_id
- list_tasks
Task retrieved successfully
| Name | Datatype | Description |
|---|---|---|
id | string | Session ID |
name | string | Session name |
task_id | string | Task ID this session belongs to |
base_ref | string | Base branch name |
completed_at | string (date-time) | Completion timestamp |
created_at | string (date-time) | Creation timestamp |
error | object | Error details for a failed session |
head_ref | string | Head branch name |
model | string | Model used for this session |
owner | object | The owner of the repository |
prompt | string | Content of the triggering event |
repository | object | The repository this session belongs to |
state | string | Current state of a session (queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelled) |
updated_at | string (date-time) | Last update timestamp |
user | object | The user who created this session |
Tasks retrieved successfully
| Name | Datatype | Description |
|---|---|---|
tasks | array | List of tasks |
total_active_count | integer (int32) | Total count of active (non-archived) tasks |
total_archived_count | integer (int32) | Total count of archived tasks |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_task_by_id | select | task_id | > [!NOTE] > This endpoint is in public preview and is subject to change. Returns a task by ID with its associated sessions | |
list_tasks | select | per_page, page, sort, direction, state, is_archived, since | > [!NOTE] > This endpoint is in public preview and is subject to change. Returns a list of tasks for the authenticated user |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
task_id | string | The unique identifier of the task. |
direction | string | The direction to sort results. Can be asc or desc. |
is_archived | boolean | Filter by archived status. When true, returns only archived tasks. When false or omitted, returns only non-archived tasks. Defaults to false. |
page | integer | The page number of the results to fetch. |
per_page | integer | The number of results per page (max 100). |
since | string (date-time) | Only show tasks updated at or after this time (ISO 8601 timestamp) |
sort | string | The field to sort results by. Can be updated_at or created_at. |
state | string | Comma-separated list of task states to filter by. Can be any combination of: queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelled. |
SELECT examples
- get_task_by_id
- list_tasks
> [!NOTE]
> This endpoint is in public preview and is subject to change.
Returns a task by ID with its associated sessions
SELECT
id,
name,
task_id,
base_ref,
completed_at,
created_at,
error,
head_ref,
model,
owner,
prompt,
repository,
state,
updated_at,
user
FROM github.agent_tasks.tasks
WHERE task_id = '{{ task_id }}' -- required
;
> [!NOTE]
> This endpoint is in public preview and is subject to change.
Returns a list of tasks for the authenticated user
SELECT
tasks,
total_active_count,
total_archived_count
FROM github.agent_tasks.tasks
WHERE per_page = '{{ per_page }}'
AND page = '{{ page }}'
AND sort = '{{ sort }}'
AND direction = '{{ direction }}'
AND state = '{{ state }}'
AND is_archived = '{{ is_archived }}'
AND since = '{{ since }}'
;