agent-automations

Create an automation for a repository

Changed on

Creates a new automation in a repository. User-owned automations remain private to their creator. Repository-owned automations are visible to anyone with read access to the repository and manageable by anyone with write access to the repository.

Fine-grained access tokens for "Create an automation for a repository"

This endpoint works with the following fine-grained token types:

The fine-grained token must have one of the following permission sets for each repository accessed by this request:

  • "Agent tasks" repository permissions (read and write)
  • "Contents" repository permissions (read and write)

The required permission set depends on each repository's Automation permission configuration.

GitHub App installation access tokens are not supported for this endpoint.

post/agents/repos/{owner}/{repo}/automations

Request

  • Base URL: https://api.github.com
  • URL: https://api.github.com/agents/repos/{owner}/{repo}/automations
  • Auth: none declared

Path parameters

ownerstring required

The account owner of the repository. The name is not case sensitive.

repostring required

The name of the repository. The name is not case sensitive.

Request body

namestring required

The name of the automation.

promptstring required

The prompt template for the automation.

modelstring

The model to use for sessions triggered by this automation. Omit to use the platform default.

toolsstring[]

The tools available to the automation.

allowed_custom_agentsstring[]

Custom agents (subagents) this automation is allowed to invoke.

enabledboolean

Whether the automation should be created enabled. Defaults to true when omitted.

owner_type'user' | 'repository'

Who owns the automation, fixed at creation. user keeps it private to its creator and its runs act as that user. repository makes it belong to the repository, visible to anyone with read access to the repository and maintainable by anyone with write access to the repository, and its runs act as the Copilot app rather than as a person. repository is rejected when repository ownership is not available for the repository. Supported values: user, repository. Defaults to user.

write_scope'trigger' | 'repository'

Controls which repository resources a run may modify. trigger limits writes to the resource that started the run, when one exists, and resources created during the run; repository allows writes to any resource in the repository. Supported values: trigger, repository.

require_actor_write_permissionboolean

When true, event-triggered runs require the event actor to have repo write permission, even when the org's allow_read_access_triggers policy is enabled. Does not apply to interval-scheduled runs, which always run as the automation owner. Defaults to false.

Response

Automation created successfully

idstring required

The unique identifier of the automation.

namestring required

The name of the automation.

enabledboolean

Whether the automation is currently enabled.

owner_type'user' | 'repository'

Who owns the automation. user keeps it private to its creator and its runs act as that user. repository makes it belong to the repository, visible to anyone with read access to the repository, and its runs act as the Copilot app rather than as a person.

write_scope'trigger' | 'repository'

Controls which repository resources a run may modify. trigger limits writes to the resource that started the run, when one exists, and resources created during the run; repository allows writes to any resource in the repository. Supported values: trigger, repository.

require_actor_write_permissionboolean

When true, event-triggered runs require the event actor to have repo write permission, even when the org's allow_read_access_triggers policy is enabled. Does not apply to interval-scheduled runs, which always run as the automation owner.

promptstring required

The prompt template for the automation.

toolsstring[]

The tools available to the automation.

allowed_custom_agentsstring[]

Custom agents (subagents) this automation is allowed to invoke.

modelstring

The model to use for sessions triggered by this automation. Omit to use the platform default.

reasoning_effortstring

The reasoning effort to use for sessions triggered by this automation. Omit or leave empty for no override. Currently supported values: none, low, medium, high, xhigh, max

created_atstring date-time required

When the automation was created.

updated_atstring date-time required

When the automation was last updated.

Changes