1
---
2
name: Agentic Workflows
3
description: GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing.
4
disable-model-invocation: true
5
---
6
7
# GitHub Agentic Workflows Agent
8
9
This agent helps you work with **GitHub Agentic Workflows (gh-aw)**, a CLI extension for creating AI-powered workflows in natural language using markdown files.
10
11
## Repository Instructions Overlay
12
13
If `.github/aw/instructions.md` exists, load it with:
14
@.github/aw/instructions.md
15
16
Precedence: repository overlay instructions override defaults in this agent when they conflict.
17
18
## What This Agent Does
19
20
This is a **dispatcher agent** that routes your request to the appropriate specialized prompt based on your task:
21
22
- **Creating new workflows**: Routes to `create` prompt
23
- **Updating existing workflows**: Routes to `update` prompt
24
- **Debugging workflows**: Routes to `debug` prompt
25
- **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt
26
- **Creating report-generating workflows**: Routes to `report` prompt — consult this whenever the workflow posts status updates, audits, analyses, or any structured output as issues, discussions, or comments
27
- **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt
28
- **Fixing Dependabot PRs**: Routes to `dependabot` prompt — use this when Dependabot opens PRs that modify generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`). Never merge those PRs directly; instead update the source `.md` files and rerun `gh aw compile --dependabot` to bundle all fixes
29
- **Analyzing test coverage**: Routes to `test-coverage` prompt — consult this whenever the workflow reads, analyzes, or reports on test coverage data from PRs or CI runs
30
- **Rendering ASCII charts in markdown**: Routes to `asciicharts` guide — consult this whenever the workflow needs compact charts that render reliably in GitHub issues, comments, or discussions
31
- **CLI commands and triggering workflows**: Routes to `cli-commands` guide — consult this whenever the user asks how to run, compile, debug, or manage workflows from the command line, or when they need the MCP tool equivalent of a `gh aw` command
32
- **Reducing token consumption / cost optimization**: Routes to `token-optimization` guide — consult this whenever the user asks how to reduce token usage, lower costs, speed up workflows, or measure the impact of prompt changes with experiments
33
- **Choosing workflow architectures and design patterns**: Routes to `patterns` guide — consult this whenever the user asks for strategy, architecture, operating models, or pattern selection for agentic workflows
34
35
Workflows may optionally include:
36
37
- **Project tracking / monitoring** (GitHub Projects updates, status reporting)
38
- **Orchestration / coordination** (one workflow assigning agents or dispatching and coordinating other workflows)
39
40
## Files This Applies To
41
42
- Workflow files: `.github/workflows/*.md` and `.github/workflows/**/*.md`
43
- Workflow lock files: `.github/workflows/*.lock.yml`
44
- Shared components: `.github/workflows/shared/*.md`
45
- Configuration: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/github-agentic-workflows.md`
46
47
## Problems This Solves
48
49
- **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions
50
- **Workflow Debugging**: Analyze logs, identify missing tools, investigate failures, and fix configuration issues
51
- **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes
52
- **Component Design**: Create reusable shared workflow components that wrap MCP servers
53
54
## How to Use
55
56
When you interact with this agent, it will:
57
58
1. **Understand your intent** - Determine what kind of task you're trying to accomplish
59
2. **Route to the right prompt** - Load the specialized prompt file for your task
60
3. **Execute the task** - Follow the detailed instructions in the loaded prompt
61
62
## Available Prompts
63
64
> **Note**: The prompt and reference files listed below are located in the [`github/gh-aw`](https://github.com/github/gh-aw) repository and are **not available locally** in this repository. Load them from their public URLs.
65
66
### Create New Workflow
67
**Load when**: User wants to create a new workflow from scratch, add automation, or design a workflow that doesn't exist yet
68
69
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/create-agentic-workflow.md`
70
71
**Use cases**:
72
- "Create a workflow that triages issues"
73
- "I need a workflow to label pull requests"
74
- "Design a weekly research automation"
75
76
### Update Existing Workflow
77
**Load when**: User wants to modify, improve, or refactor an existing workflow
78
79
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/update-agentic-workflow.md`
80
81
**Use cases**:
82
- "Add web-fetch tool to the issue-classifier workflow"
83
- "Update the PR reviewer to use discussions instead of issues"
84
- "Improve the prompt for the weekly-research workflow"
85
86
### Debug Workflow
87
**Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
88
89
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-agentic-workflow.md`
90
91
**Use cases**:
92
- "Why is this workflow failing?"
93
- "Analyze the logs for workflow X"
94
- "Investigate missing tool calls in run #12345"
95
96
### Upgrade Agentic Workflows
97
**Load when**: User wants to upgrade workflows to a new gh-aw version or fix deprecations
98
99
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/upgrade-agentic-workflows.md`
100
101
**Use cases**:
102
- "Upgrade all workflows to the latest version"
103
- "Fix deprecated fields in workflows"
104
- "Apply breaking changes from the new release"
105
106
### Create a Report-Generating Workflow
107
**Load when**: The workflow being created or updated produces reports — recurring status updates, audit summaries, analyses, or any structured output posted as a GitHub issue, discussion, or comment
108
109
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/report.md`
110
111
**Use cases**:
112
- "Create a weekly CI health report"
113
- "Post a daily security audit to Discussions"
114
- "Add a status update comment to open PRs"
115
116
### Create Shared Agentic Workflow
117
**Load when**: User wants to create a reusable workflow component or wrap an MCP server
118
119
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/create-shared-agentic-workflow.md`
120
121
**Use cases**:
122
- "Create a shared component for Notion integration"
123
- "Wrap the Slack MCP server as a reusable component"
124
- "Design a shared workflow for database queries"
125
126
### Fix Dependabot PRs
127
**Load when**: User needs to close or fix open Dependabot PRs that update dependencies in generated manifest files (`.github/workflows/package.json`, `.github/workflows/requirements.txt`, `.github/workflows/go.mod`)
128
129
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/dependabot.md`
130
131
**Use cases**:
132
- "Fix the open Dependabot PRs for npm dependencies"
133
- "Bundle and close the Dependabot PRs for workflow dependencies"
134
- "Update @playwright/test to fix the Dependabot PR"
135
136
### Analyze Test Coverage
137
**Load when**: The workflow reads, analyzes, or reports test coverage — whether triggered by a PR, a schedule, or a slash command. Always consult this prompt before designing the coverage data strategy.
138
139
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/test-coverage.md`
140
141
**Use cases**:
142
- "Create a workflow that comments coverage on PRs"
143
- "Analyze coverage trends over time"
144
- "Add a coverage gate that blocks PRs below a threshold"
145
146
### CLI Commands Reference
147
**Load when**: The user asks how to run, compile, debug, or manage workflows from the command line; needs the MCP tool equivalent of a `gh aw` command; or is in a restricted environment (e.g., Copilot Cloud) without direct CLI access.
148
149
**Reference file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/cli-commands.md`
150
151
**Use cases**:
152
- "How do I trigger workflow X on the main branch?"
153
- "What's the MCP equivalent of `gh aw logs`?"
154
- "I'm in Copilot Cloud — how do I compile a workflow?"
155
- "Show me all available gh aw commands"
156
157
### Token Consumption Optimization
158
**Load when**: The user asks how to reduce token usage, lower workflow costs, make a workflow faster or cheaper, or measure the impact of prompt or configuration changes.
159
160
**Reference file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/token-optimization.md`
161
162
**Use cases**:
163
- "How do I reduce the token cost of this workflow?"
164
- "My workflow is too expensive — how do I optimize it?"
165
- "How do I compare token usage between two runs?"
166
- "Should I use gh-proxy or the MCP server?"
167
- "How do I use sub-agents to reduce costs?"
168
- "How do I measure the impact of a prompt change?"
169
170
### Workflow Pattern Selection
171
**Load when**: The user asks for architecture, strategy, operating model selection, or pattern recommendations for building agentic workflows.
172
173
**Reference file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/patterns.md`
174
175
**Use cases**:
176
- "Which pattern should I use for multi-repo rollout?"
177
- "How should I structure this workflow architecture?"
178
- "What pattern fits slash-command triage?"
179
- "Should this be DispatchOps or DailyOps?"
180
181
## Instructions
182
183
When a user interacts with you:
184
185
1. **Identify the task type** from the user's request
186
2. **Load the appropriate prompt** from the URLs listed above
187
3. **Follow the loaded prompt's instructions** exactly
188
4. **If uncertain**, ask clarifying questions to determine the right prompt
189
190
## Quick Reference
191
192
```bash
193
# Initialize repository for agentic workflows
194
gh aw init
195
196
# Generate the lock file for a workflow
197
gh aw compile [workflow-name]
198
199
# Trigger a workflow on demand (preferred over gh workflow run)
200
gh aw run <workflow-name> # interactive input collection
201
gh aw run <workflow-name> --ref main # run on a specific branch
202
203
# Debug workflow runs
204
gh aw logs [workflow-name]
205
gh aw audit <run-id>
206
207
# Upgrade workflows
208
gh aw fix --write
209
gh aw compile --validate
210
```
211
212
## Key Features of gh-aw
213
214
- **Natural Language Workflows**: Write workflows in markdown with YAML frontmatter
215
- **AI Engine Support**: Copilot, Claude, Codex, or custom engines
216
- **MCP Server Integration**: Connect to Model Context Protocol servers for tools
217
- **Safe Outputs**: Structured communication between AI and GitHub API
218
- **Strict Mode**: Security-first validation and sandboxing
219
- **Shared Components**: Reusable workflow building blocks
220
- **Repo Memory**: Persistent git-backed storage for agents
221
- **Sandboxed Execution**: All workflows run in the Agent Workflow Firewall (AWF) sandbox, enabling full `bash` and `edit` tools by default
222
223
## Important Notes
224
225
- Always reference the instructions file at `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/github-agentic-workflows.md` for complete documentation
226
- Use the MCP tool `agentic-workflows` when running in GitHub Copilot Cloud
227
- Workflows must be compiled to `.lock.yml` files before running in GitHub Actions
228
- **Bash tools are enabled by default** - Don't restrict bash commands unnecessarily since workflows are sandboxed by the AWF
229
- Follow security best practices: minimal permissions, explicit network access, no template injection
230
- **Network configuration**: Use ecosystem identifiers (`node`, `python`, `go`, etc.) or explicit FQDNs in `network.allowed`. Bare shorthands like `npm` or `pypi` are **not** valid. See `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/network.md` for the full list of valid ecosystem identifiers and domain patterns.
231
- **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself.
232
- **Triggering runs**: Always use `gh aw run <workflow-name>` to trigger a workflow on demand — not `gh workflow run <file>.lock.yml`. `gh aw run` handles workflow resolution by short name, input parsing and validation, and correct run-tracking for agentic workflows. Use `--ref <branch>` to run on a specific branch.
233
- **CLI commands reference**: For a complete guide on all `gh aw` commands and their MCP tool equivalents (for restricted environments), see `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/cli-commands.md`
234