Skip to main content

repo_tasks

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

Overview

Namerepo_tasks
TypeResource
Idgithub.agent_tasks.repo_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_repo_and_idselectowner, repo, task_id> [!NOTE]
> This endpoint is in public preview and is subject to change.

Returns a task by ID scoped to an owner/repo path
list_tasks_for_reposelectowner, repoper_page, page, sort, direction, state, is_archived, since, creator_id> [!NOTE]
> This endpoint is in public preview and is subject to change.

Returns a list of tasks for a specific repository
create_taskinsertowner, repo, prompt> [!NOTE]
> This endpoint is in public preview and is subject to change.

Creates a new task for a repository.

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
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository. The name is not case sensitive.
task_idstringThe unique identifier of the task.
creator_idintegerFilter tasks by creator user ID
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 scoped to an owner/repo path

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.repo_tasks
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND task_id = '{{ task_id }}' -- required
;

INSERT examples

> [!NOTE]
> This endpoint is in public preview and is subject to change.

Creates a new task for a repository.

INSERT INTO github.agent_tasks.repo_tasks (
prompt,
model,
create_pull_request,
base_ref,
owner,
repo
)
SELECT
'{{ prompt }}' /* required */,
'{{ model }}',
{{ create_pull_request }},
'{{ base_ref }}',
'{{ owner }}',
'{{ repo }}'
RETURNING
id,
name,
archived_at,
artifacts,
created_at,
creator,
creator_type,
html_url,
owner,
repository,
session_count,
state,
updated_at,
url,
user_collaborators
;