GitHub Agentic Workflows

GitHub Agentic Workflows

Define AI-powered repository automation in Markdown and run AI agents with guardrails through GitHub Actions. GitHub Agentic Workflows is in Public Preview.
Loading slides...

With GitHub Agentic Workflows (gh-aw), developers define AI-powered repository automation in Markdown with YAML frontmatter and run AI agents through GitHub Actions. The gh-aw GitHub CLI extension compiles each source file into the .lock.yml workflow that GitHub Actions executes.

Use standard GitHub Actions for deterministic builds, tests, linting, deployments, and reproducible scripts. Add an agentic workflow for work that benefits from reasoning or interpretation, such as issue triage, CI investigation, documentation updates, code review, and repository reporting. The two approaches complement each other.

Supported built-in AI engines include GitHub Copilot, Claude Code, OpenAI Codex, and Google Gemini, plus Pi. Choose the engine and authentication method that fit the workflow, then keep the same Markdown-and-frontmatter authoring model.

By default, supported agent jobs use read-only GitHub access and sandboxed execution. Configured writes can be routed through validated safe outputs that run separately with scoped permissions. These controls remain configurable and require careful review.

AI agents can be manipulated by prompt injection, malicious repository content, or compromised tools. GitHub Agentic Workflows defaults to layered controls for the supported agent-job path: sandboxing limits where code can execute, scoped permissions limit what it can request, and gated outputs constrain configured writes to GitHub. Workflow authors can change some controls and must evaluate the resulting risk.

flowchart LR
    INPUT["Repository + Prompt Input"] --> TOKENS["Read-only Token"]
    TOKENS --> SECRETS["No Secrets in Agent"]
    SECRETS --> SANDBOX["Sandbox + Network Controls"]
    SANDBOX --> SAFE["Safe Outputs Gate"]
    SAFE --> DETECT["Threat Detection Scan (when enabled)"]
    DETECT --> APPLY["Scoped Write Job"]

See the Security Architecture for a full breakdown of the layered defense-in-depth model.

Cost control starts with visibility. Use gh aw logs and gh aw audit to find runs consuming the most time, tokens, and AI Credits (AIC), then tighten prompts, triggers, and model choices before spend drifts upward.

max-ai-credits gives each run a hard budget, while OpenTelemetry exports traces and token data to OTLP backends for dashboards, alerting, and cost analysis. For optimization over time, compare cost with outcomes so lower spend still produces useful accepted results.

Here’s a simple workflow that runs daily to create an upbeat status report:

---
on:
schedule: daily
permissions:
contents: read
issues: read
pull-requests: read
safe-outputs:
create-issue:
title-prefix: "[team-status] "
labels: [report, daily-status]
close-older-issues: true
---
## Daily Issues Report
Create an upbeat daily status report for the team as a GitHub issue.
## What to include
- Recent repository activity (issues, PRs, discussions, releases, code changes)
- Progress tracking, goal reminders and highlights
- Project status and recommendations
- Actionable next steps for maintainers

The gh aw compile command turns this source into a hardened .lock.yml GitHub Actions workflow. GitHub Actions then runs the selected AI engine in the configured agent environment on the declared trigger. The AI agent reads allowed repository context and requests only the tools and outputs configured in frontmatter.

Browse examples by repository task to find a starting point and learn when to use each workflow.

GitHub Agentic Workflows (gh-aw) provides five stable built-in AI engines, including Pi. Engine changes may also require a different authentication method or tool configuration; use the linked guide for each engine.

The engine import model can integrate other coding-agent CLIs through Markdown definitions. The following in-repository definitions are unsupported samples, not built-in or officially supported gh-aw engines.

See Configuring a third-party agent and the Engines reference for how to import and pin an engine definition.

The task-oriented examples catalog also covers CI failure investigation, dependency analysis, scheduled maintenance, code improvement, and security review.

Install the extension, add a sample workflow, and trigger your first run - all from the command line in minutes.

Create custom agentic workflows directly from the GitHub web interface using natural language.

Interactive workshop

New

Choose a terminal, browser, or Copilot path and work through the workshop directly in the docs with saved progress.