Skip to main content

tasks

Creates, updates, deletes, gets or lists a tasks resource.

Overview

Nametasks
TypeResource
Idgithub.agent_tasks.tasks

Fields

The following fields are returned by SELECT queries:

Task retrieved successfully

NameDatatypeDescription
idstringSession ID
namestringSession name
task_idstringTask ID this session belongs to
base_refstringBase branch name
completed_atstring (date-time)Completion timestamp
created_atstring (date-time)Creation timestamp
errorobjectError details for a failed session
head_refstringHead branch name
modelstringModel used for this session
ownerobjectThe owner of the repository
promptstringContent of the triggering event
repositoryobjectThe repository this session belongs to
statestringCurrent state of a session (queued, in_progress, completed, failed, idle, waiting_for_user, timed_out, cancelled)
updated_atstring (date-time)Last update timestamp
userobjectThe user who created this session

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_task_by_idselecttask_id> [!NOTE]
> This endpoint is in public preview and is subject to change.

Returns a task by ID with its associated sessions
list_tasksselectper_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.

NameDatatypeDescription
task_idstringThe unique identifier of the task.
directionstringThe direction to sort results. Can be asc or desc.
is_archivedbooleanFilter by archived status. When true, returns only archived tasks. When false or omitted, returns only non-archived tasks. Defaults to false.
pageintegerThe page number of the results to fetch.
per_pageintegerThe number of results per page (max 100).
sincestring (date-time)Only show tasks updated at or after this time (ISO 8601 timestamp)
sortstringThe field to sort results by. Can be updated_at or created_at.
statestringComma-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

> [!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
;