エージェント タスクの REST API エンドポイント
REST API を使用して、 Copilot クラウドエージェント タスクを開始および管理する
List tasks for repository
Note
This endpoint is in public preview and is subject to change.
Returns a list of tasks for a specific repository
Fine-grained access tokens for "List tasks for repository"
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
- "Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
"List tasks for repository" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository. The name is not case sensitive. |
| 名前, タイプ, 説明 |
|---|
per_page integer The number of results per page (max 100). デフォルト: |
page integer The page number of the results to fetch. デフォルト: |
sort string The field to sort results by. Can be デフォルト: 次のいずれかにできます: |
direction string The direction to sort results. Can be デフォルト: 次のいずれかにできます: |
state string Comma-separated list of task states to filter by. Can be any combination of: |
is_archived boolean Filter by archived status. When デフォルト: |
since string Only show tasks updated at or after this time (ISO 8601 timestamp) |
creator_id array Filter tasks by creator user ID. Accepts one or more user IDs. |
"List tasks for repository" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Tasks retrieved successfully |
400 | Bad request |
401 | Authentication required |
403 | Insufficient permissions |
404 | Resource not found |
422 | Validation Failed |
"List tasks for repository" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/agents/repos/OWNER/REPO/tasksTasks retrieved successfully
Status: 200{
"tasks": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"url": "https://api.github.com/agents/repos/octocat/hello-world/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"html_url": "https://github.com/octocat/hello-world/copilot/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"creator": {
"id": 1
},
"creator_type": "user",
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"state": "completed",
"session_count": 1,
"artifacts": [
{
"provider": "github",
"type": "pull",
"data": {
"id": 42
}
}
],
"archived_at": null,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T01:00:00Z"
}
]
}Start a task
Note
This endpoint is in public preview and is subject to change.
Starts a new Copilot cloud agent task for a repository.
This endpoint is only available to users with a Copilot Business or Copilot Enterprise subscription.
Fine-grained access tokens for "Start a task"
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
- "Agent tasks" repository permissions (read and write)
GitHub App installation access tokens are not supported for this endpoint.
"Start a task" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository. The name is not case sensitive. |
| 名前, タイプ, 説明 |
|---|
prompt string 必須The user's prompt for the agent |
model string The model to use for this task. The allowed models may change over time and depend on the user's GitHub Copilot plan and organization policies. Currently supported values: |
custom_agent string Optional identifier for a custom agent to use for this task. Use the custom agent's filename without the extension - for example, for a |
create_pull_request boolean Whether to create a PR. デフォルト: |
base_ref string Base ref for new branch/PR |
head_ref string Head ref for existing branch/PR. If provided with |
"Start a task" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
201 | Task created successfully |
400 | Problems parsing JSON |
401 | Authentication required |
403 | Insufficient permissions |
422 | Validation Failed |
"Start a task" のコード サンプル
リクエスト例
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/agents/repos/OWNER/REPO/tasks \
-d '{"prompt":"Fix the login button on the homepage","base_ref":"main"}'Task created successfully
Status: 201{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"url": "https://api.github.com/agents/repos/octocat/hello-world/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"html_url": "https://github.com/octocat/hello-world/copilot/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"creator": {
"id": 1
},
"creator_type": "user",
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"state": "queued",
"session_count": 1,
"artifacts": [],
"archived_at": null,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:00:00Z"
}Get a task by repo
Note
This endpoint is in public preview and is subject to change.
Returns a task by ID scoped to an owner/repo path
Fine-grained access tokens for "Get a task by repo"
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
- "Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
"Get a task by repo" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
owner string 必須The account owner of the repository. The name is not case sensitive. |
repo string 必須The name of the repository. The name is not case sensitive. |
task_id string 必須The unique identifier of the task. |
"Get a task by repo" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Task retrieved successfully |
400 | Bad request |
401 | Authentication required |
403 | Insufficient permissions |
404 | Resource not found |
422 | Validation Failed |
"Get a task by repo" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/agents/repos/OWNER/REPO/tasks/TASK_IDTask retrieved successfully
Status: 200{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"url": "https://api.github.com/agents/repos/octocat/hello-world/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"html_url": "https://github.com/octocat/hello-world/copilot/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"creator": {
"id": 1
},
"creator_type": "user",
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"state": "completed",
"session_count": 1,
"artifacts": [
{
"provider": "github",
"type": "pull",
"data": {
"id": 42
}
}
],
"archived_at": null,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T01:00:00Z",
"sessions": [
{
"id": "s1a2b3c4-d5e6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"user": {
"id": 1
},
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"state": "completed",
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T01:00:00Z",
"completed_at": "2025-01-01T01:00:00Z",
"prompt": "Fix the login button on the homepage",
"head_ref": "copilot/fix-1",
"base_ref": "main",
"model": "claude-sonnet-4.6"
}
]
}List tasks
Note
This endpoint is in public preview and is subject to change.
Returns a list of tasks for the authenticated user
Fine-grained access tokens for "List tasks"
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
- "Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
"List tasks" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
per_page integer The number of results per page (max 100). デフォルト: |
page integer The page number of the results to fetch. デフォルト: |
sort string The field to sort results by. Can be デフォルト: 次のいずれかにできます: |
direction string The direction to sort results. Can be デフォルト: 次のいずれかにできます: |
state string Comma-separated list of task states to filter by. Can be any combination of: |
is_archived boolean Filter by archived status. When デフォルト: |
since string Only show tasks updated at or after this time (ISO 8601 timestamp) |
"List tasks" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Tasks retrieved successfully |
400 | Bad request |
401 | Authentication required |
403 | Insufficient permissions |
422 | Validation Failed |
"List tasks" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/agents/tasksTasks retrieved successfully
Status: 200{
"tasks": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"creator": {
"id": 1
},
"creator_type": "user",
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"state": "completed",
"session_count": 1,
"artifacts": [
{
"provider": "github",
"type": "pull",
"data": {
"id": 42
}
}
],
"archived_at": null,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T01:00:00Z"
}
]
}Get a task by ID
Note
This endpoint is in public preview and is subject to change.
Returns a task by ID with its associated sessions
Fine-grained access tokens for "Get a task by ID"
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
- "Agent tasks" repository permissions (read)
GitHub App installation access tokens are not supported for this endpoint.
"Get a task by ID" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
task_id string 必須The unique identifier of the task. |
"Get a task by ID" の HTTP 応答状態コード
| 状態コード | 説明 |
|---|---|
200 | Task retrieved successfully |
400 | Problems parsing request |
401 | Authentication required |
403 | Insufficient permissions |
404 | Resource not found |
422 | Validation Failed |
"Get a task by ID" のコード サンプル
要求の例
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/agents/tasks/TASK_IDTask retrieved successfully
Status: 200{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"url": "https://api.github.com/agents/repos/octocat/hello-world/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"html_url": "https://github.com/octocat/hello-world/copilot/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"creator": {
"id": 1
},
"creator_type": "user",
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"state": "completed",
"session_count": 1,
"artifacts": [
{
"provider": "github",
"type": "pull",
"data": {
"id": 42
}
}
],
"archived_at": null,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T01:00:00Z",
"sessions": [
{
"id": "s1a2b3c4-d5e6-7890-abcd-ef1234567890",
"name": "Fix the login button on the homepage",
"user": {
"id": 1
},
"owner": {
"id": 1
},
"repository": {
"id": 1296269
},
"task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"state": "completed",
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T01:00:00Z",
"completed_at": "2025-01-01T01:00:00Z",
"prompt": "Fix the login button on the homepage",
"head_ref": "copilot/fix-1",
"base_ref": "main",
"model": "claude-sonnet-4.6"
}
]
}