⚙️

Configuration Reference

Complete frontmatter schema and field reference

Prerequisites

Before creating agentic workflows, ensure you have the following:

✅ Required

  • GitHub Copilot subscription — Pro, Pro+, Business, or Enterprise plan
  • GitHub CLIgh v2.45.0 or above (cli.github.com)
  • gh-aw extensiongh extension install github/gh-aw
  • Repository admin access — needed to manage secrets and enable workflows

🔑 Tokens & Secrets

  • COPILOT_GITHUB_TOKEN — required repo secret; fine-grained PAT with Copilot Requests permission (see Authentication)
  • GH_AW_AGENT_TOKEN — optional repo secret; PAT for assign-to-agent safe output
  • Custom PAT or GitHub App — optional, for safe-output writes under a different identity

What gh aw init Does

Running gh aw init in your repository:

  • ✅ Creates .github/workflows/copilot-setup-steps.yml — the environment setup file for the agentic workflow runner
  • ✅ Walks you through selecting an AI engine (Copilot, Claude, Codex)
  • ✅ Provides instructions for setting up required secrets
  • ❌ Does not create the COPILOT_GITHUB_TOKEN secret — you must do this manually
# Initialize the repo
gh aw init --engine copilot

# Then manually create the required secret
gh secret set COPILOT_GITHUB_TOKEN -R owner/repo
# (paste your fine-grained PAT when prompted)

⚠️ Without COPILOT_GITHUB_TOKEN, the activation step will fail immediately. This is the first thing to check when troubleshooting a failed workflow run.

How Configuration Works

Every agentic workflow is a .md file in .github/workflows/ with two parts:

📋 YAML Frontmatter

Structured config between --- markers — triggers, permissions, tools, engine, and safe outputs. Validated at compile time.

📝 Markdown Body

Natural-language instructions for the AI agent. Editable without recompilation — the agent interprets these contextually at runtime.

# File: .github/workflows/triage-issues.md
---
on:
  issues:
    types: [opened]
permissions: read-all
safe-outputs:
  add-labels:
    allowed: [bug, feature, docs]
  add-comment: {}
---

# Issue Triage Agent
Analyze new issues and apply the appropriate label.
Explain your reasoning in a comment.

💡 Run gh aw compile to transform the .md file into a .lock.yml — a security-hardened GitHub Actions workflow. The lock file is what Actions executes.

Authentication & Tokens

Agentic workflows use repository secrets for authentication. The compiled .lock.yml workflow references these secrets at runtime during the activation and safe-outputs steps.

COPILOT_GITHUB_TOKEN — The Core Requirement

Every agentic workflow needs COPILOT_GITHUB_TOKEN — a fine-grained PAT from a user with an active Copilot license. The compiled workflow validates this secret during activation; without it, the run fails immediately.

Creating the Token

  1. Go to github.com/settings/personal-access-tokens
  2. Select Fine-grained token → choose your target repository or Public Repositories
  3. Under Account permissions, grant Copilot Requests: Read-only
  4. Copy the generated token and store it as a repo secret:
gh secret set COPILOT_GITHUB_TOKEN -R owner/repo
# Paste your fine-grained PAT when prompted

⚠️ COPILOT_GITHUB_TOKEN is not the built-in GITHUB_TOKEN. It must be a PAT from a user whose Copilot subscription is consumed for premium requests. The token owner’s account must have Copilot access.

Additional Secrets

Depending on your workflow configuration, you may need additional repository secrets:

SecretWhen NeededPermission
COPILOT_GITHUB_TOKENAlways — every agentic workflowCopilot Requests: Read-only
GH_AW_AGENT_TOKENUsing assign-to-agent safe outputIssues: Read & Write
ANTHROPIC_API_KEYUsing engine: claude
OPENAI_API_KEYUsing engine: codex
GEMINI_API_KEYUsing engine: gemini
GH_AW_SECURITY_ALERTS_TOKENSecurity monitoring workflowsDependabot, Code scanning, Secret scanning alerts

💡 All secrets are stored as regular repository secrets (Settings → Secrets and variables → Actions). MCP server secrets referenced in the workflow frontmatter also go here, using the ${{ secrets.NAME }} syntax.

Custom Tokens for Safe Outputs

By default, safe-output write operations use the built-in GITHUB_TOKEN. To use a different identity for writes (e.g., a bot account, a GitHub App), configure github-token: or github-app: in your safe-outputs.

🔑 Fine-Grained PAT

Use a PAT for full control. Supports all safe-output types including assign-to-agent.

safe-outputs:
  github-token:
    secret: MY_BOT_PAT
  create-pull-request:
    draft: true
  assign-to-agent:
    allowed: [copilot]

🤖 GitHub App

Use a GitHub App for scoped, short-lived tokens. Better for orgs — no personal account needed.

safe-outputs:
  github-app:
    app-id: ${{ vars.APP_ID }}
    private-key: ${{ secrets.APP_KEY }}
  create-pull-request:
    draft: true
  add-comment: {}

PAT Required Scopes

ScopeRequired For
contents: writeCreating PRs, pushing code
issues: writeCreating/updating issues, adding labels
pull-requests: writePR reviews, comments
actions: writeDispatching workflows

⚠️ GitHub App limitation: The assign-to-agent safe output requires a fine-grained PAT — GitHub App installation tokens are not supported by the Copilot assignment API. If you use github-app: for other safe outputs, set the GH_AW_AGENT_TOKEN repository secret (a PAT) as a fallback for agent assignment.

Token Summary

ScenarioToken TypeWhere to Configure
Running any agentic workflowFine-grained PATCOPILOT_GITHUB_TOKEN repo secret
Third-party engine (Claude, Codex, Gemini)API keyEngine-specific repo secret
MCP server authenticationSecretRepo secret, referenced via ${{ secrets.NAME }}
Safe-output writes (custom identity)PAT or GitHub Appgithub-token: or github-app: in frontmatter
Assign-to-agentFine-grained PAT onlyGH_AW_AGENT_TOKEN repo secret

Complete Frontmatter Schema

35+ fields
FieldTypeRequiredDefaultDescription
namestringNoFilenameDisplay name in GitHub Actions UI
descriptionstringNoHuman-readable workflow description
onstring / objectYesTrigger events and access controls
permissionsstring / objectNoread-allGitHub token permission scopes
enginestring / objectNocopilotAI engine and model selection
toolsobjectNoAvailable tools for the agent
mcp-serversobjectNoCustom Model Context Protocol servers
mcp-scriptsobjectNoInline MCP tools via JS/shell scripts
safe-outputsobjectNoPermitted write operations
networkstring / objectNodefaultsNetwork access control (AWF)
sandboxstring / objectNoawfSandbox configuration (AWF + MCP gateway)
strictbooleanNotrueEnhanced security validation
importsstring[] / object[]NoImport shared config from other .md files
sourcestringNoOrigin tracking (owner/repo/path@ref)
secretsobjectNoSecret values for workflow execution
environmentstring / objectNoDeployment protection rules
containerstring / objectNoContainer image for job steps
servicesobjectNoService containers (databases, caches)
stepsarrayNoCustom steps before agentic execution
post-stepsarrayNoCustom steps after agentic execution
jobsobjectNoCustom jobs alongside agentic execution
envobjectNoWorkflow-level environment variables
cacheobject / arrayNoGitHub Actions cache configuration
concurrencystring / objectNoWorkflow concurrency control
runs-onstring / arrayNoubuntu-latestRunner label for main job
timeout-minutesintegerNo20Maximum execution time
ifstringNoConditional execution expression
run-namestringNoWorkflow nameCustom run display name
privatebooleanNofalsePrevent external installation
labelsstring[]NoWorkflow categorization tags
metadataobjectNoCustom key-value pairs
resourcesstring[]NoCompanion files for gh aw add
runtimesobjectNoOverride default runtime versions
featuresobjectNoExperimental feature flags

Trigger Events (on:)

30+ triggers

The on: field uses standard GitHub Actions trigger syntax, extended with gh-aw-specific controls.

Standard Triggers

TriggerKeyCommon TypesUse Case
Issuesissuesopened, edited, labeledReact to issue lifecycle
Pull Requestpull_requestopened, synchronizeReact to PR events
Issue Commentissue_commentcreatedChatOps, respond to comments
PushpushReact to code pushes
SchedulescheduleRecurring automation
Workflow Dispatchworkflow_dispatchManual trigger with inputs
Workflow Runworkflow_runChain after another workflow
Discussiondiscussioncreated, editedReact to discussions
ReleasereleasepublishedAuto-generate changelogs

🕐 Fuzzy Schedule Syntax

Human-friendly schedules. The compiler assigns deterministic scattered times based on file path.

on:
  schedule: daily                              # Scattered daily
  schedule: daily around 14:00                 # ±1 hour of 14:00
  schedule: daily between 9:00 and 17:00       # Business hours
  schedule: weekly on friday around 5pm        # Weekly on Fridays
  schedule: hourly                             # Every hour
  schedule: every 10 minutes                   # Minimum 5 minutes

⚡ Slash & Label Commands

# Slash command — users type /review in comments
on:
  slash_command: "review"

# Label command — fires when label is added
on:
  label_command: "deploy"

🔧 gh-aw Trigger Extensions

FieldTypeDescription
reactionstringEmoji reaction on trigger (eyes, rocket, none)
status-commentbooleanPost started/completed comments
stop-afterstringAuto-disable deadline (+90d, 2024-12-31)
manual-approvalstringEnvironment name for human approval gate
rolesstring[]Required repo roles (admin, maintainer, write)
skip-botsstring[]Skip for listed bot actors
lock-for-agentbooleanLock issue during execution
skip-if-matchstring / objectSkip if GitHub search query matches
skip-if-check-failingboolean / objectSkip if CI checks are failing

Permissions

⚠️ Read-only by default. In strict mode (enabled by default), write permissions are refused — you must use safe-outputs for all write operations.

# Shorthand
permissions: read-all

# Granular
permissions:
  contents: read
  issues: read
  pull-requests: read
  models: read        # Required for Copilot AI model access
ScopeValuesNotes
contentsread / write / noneRepository file access
issuesread / write / noneIssue API access
pull-requestsread / write / nonePR API access
actionsread / write / noneWorkflow and run access
checksread / write / noneCheck runs and suites
discussionsread / write / noneDiscussion API
modelsread / noneGitHub Copilot AI model access
security-eventsread / write / noneCode scanning, Dependabot
packagesread / write / nonePackage registry
statusesread / write / noneCommit status API
id-tokenwrite / noneOIDC JWT tokens

Engine Configuration

4 engines

🤖 Copilot default

GitHub’s own coding agent. Uses Copilot premium requests.

engine: copilot

🧠 Claude

Anthropic’s coding agent. Requires ANTHROPIC_API_KEY.

engine: claude

💻 Codex

OpenAI’s coding agent. Requires OPENAI_API_KEY.

engine: codex

✨ Gemini

Google’s coding agent. Requires GEMINI_API_KEY.

engine: gemini

Extended Engine Configuration

engine:
  id: copilot
  version: "0.0.422"            # Pin specific CLI version
  model: gpt-5                  # Override default model
  agent: technical-doc-writer   # Custom agent (.github/agents/<name>.agent.md)
  max-continuations: 3          # Autopilot mode (Copilot only)
  max-turns: 50                 # Max chat iterations (Claude only)
  env:
    DEBUG_MODE: "true"

Tools Configuration

12 built-in tools
ToolKeyDescription
GitHubgithub:GitHub API operations via MCP server
Bashbash:Shell command execution (sandboxed)
Editedit:File editing in workspace
Web Fetchweb-fetch:Fetch web content
Web Searchweb-search:Search the web
Playwrightplaywright:Browser automation and testing
Cache Memorycache-memory:Persistent memory across runs
Repo Memoryrepo-memory:Git-based context storage
Agentic Workflowsagentic-workflows:Workflow introspection
Serenaserena:AI-powered code intelligence (LSP)
QMDqmd:Documentation vector search

GitHub Tool — Toolsets

tools:
  github:
    toolsets: [repos, issues, pull_requests, labels, code_search]
    read-only: true
    lockdown: true

Bash — Command Allowlisting

tools:
  bash:                              # Default safe commands only
  bash: true                         # All commands
  bash: ["echo", "git:*", "npm"]     # Specific commands

Complete Example

tools:
  edit:
  bash: ["gh", "git:*", "npm", "node"]
  github:
    toolsets: [issues, pull_requests, labels]
  web-fetch:
  web-search:
  cache-memory:
    key: "project-context"
  playwright:
  serena: ["typescript", "python"]
  timeout: 120

Safe Outputs

30+ types

Safe outputs are the security boundary between read-only AI execution and write operations. The agent produces structured output; separate permission-controlled jobs execute the writes.

Issues & Discussions

TypeKeyMaxDescription
Create Issuecreate-issue1Create GitHub issues with labels, assignees
Update Issueupdate-issue1Update issue status, title, body
Close Issueclose-issue1Close issues with comment
Create Discussioncreate-discussion1Create GitHub discussions

Pull Requests

TypeKeyMaxDescription
Create PRcreate-pull-request1Create PRs with code changes
Push to PRpush-to-pull-request-branch1Push changes to existing PR branch
Review Commentscreate-pull-request-review-comment10Line-specific review comments
Submit Reviewsubmit-pull-request-review1APPROVE / REQUEST_CHANGES / COMMENT

Labels, Assignments & Comments

TypeKeyMaxDescription
Add Commentadd-comment1Post comments on issues/PRs/discussions
Add Labelsadd-labels3Add labels (with allowlist)
Remove Labelsremove-labels3Remove labels
Add Revieweradd-reviewer3Add reviewers to PRs
Assign to Agentassign-to-agent1Assign Copilot to issues/PRs

Workflows & Security

TypeKeyMaxDescription
Dispatch Workflowdispatch-workflow1Trigger other agentic workflows
Call Workflowcall-workflow1Call reusable workflows (fan-out)
Code Scanningcreate-code-scanning-alertGenerate SARIF security advisories
Upload Assetupload-asset10Publish files to orphaned git branch

Examples

safe-outputs:
  create-issue:
    title-prefix: "[ai] "
    labels: [automation, agentic]
    assignees: [copilot]
    max: 5
    expires: 7

  create-pull-request:
    title-prefix: "[ai] "
    draft: true
    reviewers: [copilot]
    auto-merge: true
    protected-files: "blocked"

  add-labels:
    allowed: [bug, enhancement, docs]
    max: 5

  add-comment:
    max: 3
    hide-older-comments: true

Custom MCP Servers

Three connection modes for external tools:

📡 Process (stdio)

mcp-servers:
  slack:
    command: "npx"
    args: ["-y", "@slack/mcp-server"]
    env:
      SLACK_BOT_TOKEN: "${{ secrets.SLACK_TOKEN }}"

🐳 Container (Docker)

mcp-servers:
  custom-db:
    container: "ghcr.io/org/db-mcp:latest"
    env:
      DATABASE_URL: "${{ secrets.DB_URL }}"

🌐 HTTP Endpoint

mcp-servers:
  remote-api:
    url: "https://api.example.com/mcp"
    headers:
      Authorization: "Bearer ${{ secrets.TOKEN }}"

Network Configuration

Controlled by the Agent Workflow Firewall (AWF). Only whitelisted domains are accessible.

network: defaults                   # Basic infrastructure only

network:
  allowed:
    - defaults                      # Basic infra
    - python                        # PyPI ecosystem
    - node                          # NPM ecosystem
    - github                        # GitHub domains
    - "api.example.com"             # Custom domain
  blocked:
    - "cdn.tracker.com"             # Block specific (takes precedence)

Ecosystem Identifiers

IDCovers
defaultsCertificates, JSON schema, Ubuntu mirrors
githubGitHub and adjacent domains
pythonPyPI, pip
nodenpm, yarn, pnpm
goproxy.golang.org
rustcrates.io
javaMaven Central, Gradle
dotnetNuGet
containersDocker Hub, GHCR, Quay
terraformHashiCorp domains
playwrightBrowser downloads
linux-distrosDebian, Alpine repos

Advanced Configuration

Imports — Shared Configuration

imports:
  - "./shared/base-config.md"                          # Local file
  - "githubnext/agentics/shared/security.md@main"      # Remote

Concurrency

concurrency:
  group: "gh-aw-${{ github.workflow }}"
  cancel-in-progress: true

Custom Steps

steps:                             # Run BEFORE agent
  - uses: actions/setup-node@v4
    with:
      node-version: "20"

post-steps:                        # Run AFTER agent
  - run: echo "Agent completed"

Complete Workflow Example

---
name: "CI Failure Investigator"
description: "Investigates CI failures and proposes fixes"

on:
  workflow_run:
    workflows: ["CI"]
    types: [completed]
  roles: [admin, maintainer]
  stop-after: "+90d"

permissions:
  contents: read
  actions: read
  issues: read

engine:
  id: copilot
  max-continuations: 3

tools:
  edit:
  bash: ["gh", "git:*", "npm"]
  github:
    toolsets: [repos, issues, pull_requests]

safe-outputs:
  create-pull-request:
    title-prefix: "[ci-fix] "
    labels: [ci-fix, automation]
    draft: true
  add-comment:
    max: 2

network:
  allowed:
    - defaults
    - node
    - github

timeout-minutes: 15
---

# CI Failure Investigator

When a CI workflow fails, investigate the failure:

1. Read the failed workflow logs
2. Identify the root cause
3. Search the codebase for the relevant code
4. Propose a fix as a pull request
5. Comment on the triggering issue with your analysis