Rate Limiting Controls

GitHub Agentic Workflows uses defense-in-depth to prevent runaway workflows: bot non-triggering, concurrency controls, timeouts, rate limiting, read-only agents, safe output limits, built-in delays, and manual review gates.

The github-actions[bot] account does not trigger workflow events. When a workflow creates an issue or posts a comment via safe outputs, it won’t trigger other workflows - preventing infinite loops.

on:
issues:
types: [opened]

This workflow won’t be triggered by issues created by safe outputs.

Workflows use dual concurrency control: per-workflow (based on context) and per-engine (one agent job at a time per AI engine).

concurrency:
group: gh-aw-${{ github.workflow }}
jobs:
agent:
concurrency:
group: gh-aw-copilot

This prevents parallel execution explosions and AI resource exhaustion. See Concurrency Control for trigger-specific patterns.

The agent step defaults to 20 minutes, set by the top-level timeout-minutes field. Other jobs default to the platform limit of 360 minutes. Custom runners support longer timeouts:

timeout-minutes: 120 # Apply 120-minute timeout to the agent execution step

stop-after limits how long a workflow can run:

stop-after: +48h # Stop after 48 hours from trigger

It is checked in the agent job’s if: condition and accepts absolute dates or relative deltas (minimum unit: hours).

Agents run read-only. All writes (issues, comments, workflow triggers) go through the safe outputs system, which validates, audits, and rate-limits them.

permissions:
contents: read
issues: read
pull-requests: read

High-risk operations have default max limits to prevent exponential growth:

OperationDefault MaxPurpose
assign-to-agent1Prevent agent cascades
assign-to-bot1Prevent bot loops
dispatch-workflow1Prevent workflow explosions
safe-outputs:
assign-to-agent:
max: 3 # Override default if needed

Without limits, one workflow could spawn three agents, each spawning three more, creating exponential growth. The default max of 1 ensures linear progression.

Critical operations have hardcoded, non-disableable delays:

  • Agent assignments: 10-second delay between each assignment
  • Workflow dispatches: 5-second delay between each dispatch

Require manual approval for sensitive operations using GitHub Environments:

safe-outputs:
dispatch-workflow:
environment: production # Requires approval

Create the environment under Settings → Environments with reviewers, then reference it. Use for production dispatches, cross-repo operations, or security-sensitive actions.

user-rate-limit is experimental; gh aw compile emits an experimental feature warning when a workflow uses it. This limits how often each user can trigger a workflow:

user-rate-limit:
max-runs-per-window: 5 # Required: Maximum runs per window (1-10)
window: 60 # Optional: Time window in minutes (default: 60, max: 180)
events: [workflow_dispatch, issue_comment] # Optional: Specific events (inferred from `on:` when omitted; fallback to all supported programmatic events)
ignored-roles: [admin, maintain] # Optional: Roles exempt from rate limiting (default: [admin, maintain, write])

The pre-activation job checks recent runs and cancels the current run if the limit is exceeded.

Role exemptions: Users with admin, maintain, or write roles are exempt by default. To rate-limit everyone, set ignored-roles: [].

The max-daily-ai-credits frontmatter field caps the total AI Credits a workflow can consume across all runs in a rolling 24-hour window:

max-daily-ai-credits: 5000 # Block new runs once this workflow
# exceeds 5000 AIC in the last 24 hours

Runs fail before the agent starts if the workflow already exceeds the threshold in the last 24 hours. The default threshold is 5000 AIC (approximately $50 USD). Set the value to -1 to disable the guardrail for a specific workflow.

Bypass exceptions: The guardrail is skipped for user-initiated and command-driven runs, so it never blocks intentional actions:

  • Manual triggers: workflow_dispatch runs from the GitHub UI or CLI.
  • Slash and label commands: Runs triggered by slash commands (direct or dispatcher-routed) or label commands.
  • Centralized invocations: workflow_call and repository_dispatch events. The calling workflow manages its own budget.

GitHub API quota is separate from daily AI Credits. Daily AIC inspection reports these quota classifications:

  • quota_exhausted: Zero remaining requests, from a rate-limit response or protective quota stop.
  • quota_reserve: Inspection stopped at the protective reserve.
  • rate_limited: A rate-limit response. Missing quota headers do not imply zero remaining.
  • authentication_failed (HTTP 401) and permission_denied (403 without rate-limit evidence): Kept even at an empty budget.

Quota-limited accounting is unverified and blocks agent startup. It is not a measured credit overrun. Reset and Retry-After values are earliest retry times, not automatic retries. Restore failures name the stopped read (such as current_run) and attempt count in logs and the step summary.

---
name: Safe Agent Workflow
engine:
id: copilot
timeout-minutes: 60 # Job timeout
on:
issues:
types: [opened]
user-rate-limit:
max-runs-per-window: 5
window: 60
stop-after: +2h # Workflow time limit
safe-outputs:
assign-to-agent:
max: 1
environment: production
---

This combines rate limiting (5/hour per user), concurrency control, timeouts (60 min job, 2h workflow), manual approval, and a max-1 agent limit.

Start with conservative limits and raise them as needed. Use environments for high-risk operations, such as production dispatches.

Workflow immediately cancelled: Check rate limit in pre-activation logs, verify concurrency queue, or confirm stop-after hasn’t exceeded.

Agent assignments slow: Built-in 10-second delays are intentional. Five agents = ~40 seconds total.

Workflow dispatch not triggering: Verify max dispatch limit (default: 1), check 5-second delay, confirm target workflow has on: workflow_dispatch, or check pending environment approvals.