---
title: "Wake AI Agents on Dependabot Alerts with Hooks | AgentRQ Tutorials"
url: https://agentrq.com/tutorials/subscribe-ai-coding-agents-to-dependabot-alerts-with-hooks-claude-code-codex-antigravity
description: "Wake Claude Code, Codex, Antigravity or any ACP agent on every Dependabot alert: an AgentRQ hook turns each alert into a task, and the agent opens the fix PR."
---

![](https://agentrq.com/assets/guideline-icons/security.svg) Tested December 5, 2026 | [All Tutorials](https://agentrq.com/tutorials/)

# Wake AI Agents on Dependabot Alerts with Hooks

Dependabot finds the vulnerable package, names the advisory and tells you which version fixes it. Then the alert waits in the Security tab until somebody has an hour to check it is real, bump the package, update the lockfile, run the tests and open a pull request. On a busy team, that hour does not come, and the list grows.

That hour is exactly what a coding agent is good at. What the agent lacks is the alert: Claude Code, Codex or Antigravity running in your checkout does not watch the Security tab, and a terminal session has no address GitHub could call.

This tutorial subscribes your agent to Dependabot alerts. Every open alert becomes a task in the workspace where the agent works, the agent wakes up and takes it, checks that the alert is still open and not already fixed, upgrades the package on a branch and runs the tests, then asks you before it pushes and opens the pull request. It works the same for Claude Code and for every agent that connects through the ACP Gateway, such as Codex, Antigravity, Gemini CLI, GitHub Copilot or Cursor.

The screenshots come from the AgentRQ app on December 1, 2026, fed by the exact requests the workflow in Step 4 sends.

**Update, December 5, 2026:** since AgentRQ v0.22.1, the built-in github hook takes GitHub's Dependabot alert webhook directly and fires **dependabot.alert** the moment an alert opens, with no workflow or schedule. [Resolve Dependabot alerts with an AI coding agent](https://agentrq.com/guidelines/hooks/resolve-dependabot-alerts-with-an-ai-coding-agent-using-the-github-hook) sets that up. The scheduled route below still helps to work through alerts that were already open, or on a server with an older github hook.

![The flow: once, you make an api-service workspace with an agent connected, a dependabot_alert event with a trigger, and a generic hook with a scheduled workflow. Every 30 minutes, GitHub Actions lists the open Dependabot alerts and sends each one to the generic hook, which checks the token. A new alert fires dependabot_alert and becomes a task in api-service, handed to the connected agent within a minute; one sent before is a duplicate and makes no second task. The agent checks, bumps and tests, you allow git push and gh pr create, and the pull request opens; the alert closes on merge. Claude Code over its MCP channel, and Codex, Antigravity, Gemini CLI and others over the ACP Gateway, get the same task.](https://agentrq.com/assets/tutorials/dependabot-alerts-00-flow.svg)

## What You Build

| Piece | Setting | What it does |
| --- | --- | --- |
| api-service workspace | Working directory: your repository's checkout. YOLO mode off | Where the agent works on each alert, and asks before it pushes |
| Your agent | Claude Code, or any ACP agent, started on a machine | Wakes up when a task arrives |
| dependabot_alert event | A trigger that gives api-service "Fix Dependabot alert in api-service" | One task for every open alert, with the alert pasted in |
| generic hook registration | A token. Route: request.received to dependabot_alert | The address the workflow sends alerts to |
| GitHub Actions workflow | Every 30 minutes, one request per open alert | Reads the Dependabot alerts API and sends each alert once |

Three ideas make it work:

- → **A hook gives your account an address.** A [hook](https://agentrq.com/features/hooks) is a URL that checks every request and turns it into one of your [events](https://agentrq.com/features/events). The built-in generic hook checks a shared token and passes the body through, so no code runs on the AgentRQ side.
- → **An event becomes a task, and a task wakes the agent.** The event's trigger creates a task in the [workspace](https://agentrq.com/features/workspace). AgentRQ hands it to whichever agent is connected there: Claude Code receives it through its channel, an ACP agent as a new prompt. The agent never polls GitHub and needs no public address.
- → **You keep the gate.** With [YOLO mode](https://agentrq.com/features/yolo-mode) off, git push and gh pr create wait for your **Allow Once**, from the browser or your phone.

## Why Not GitHub's Webhook Directly?

GitHub does send a dependabot_alert webhook, but it signs it with X-Hub-Signature-256, and the generic hook checks a token in a header, which GitHub's webhooks cannot add. The built-in github hook checks that signature but does not read Dependabot alerts: it fires CI runs, pull requests, issues, releases and pushes. GitHub Actions has no Dependabot alert trigger either.

So this tutorial reads the alerts the way GitHub documents: a scheduled workflow calls the Dependabot alerts API and sends each open alert to the generic hook. It works on hosted AgentRQ with nothing to install, and the wake-up is at most 30 minutes late. If you self-host and want it instant, see [Real Time on a Self-Hosted Server](https://agentrq.com/tutorials/subscribe-ai-coding-agents-to-dependabot-alerts-with-hooks-claude-code-codex-antigravity#real-time) below.

## Before You Start

- → An AgentRQ account, and a computer with a checkout of the repository, where the agent will run. See [machines](https://agentrq.com/features/machines) and the [connect agents guidelines](https://agentrq.com/guidelines/connect-agents/).
- → An agent that connects to AgentRQ: Claude Code over [MCP](https://agentrq.com/features/mcp-integration), or Codex, Antigravity, Gemini CLI and the other ACP agents through the [ACP Gateway](https://agentrq.com/docs/connect-acp-agent). Step 1 shows each.
- → The GitHub CLI on that computer, signed in with gh auth login, so the agent can read the alert, push a branch and open a pull request.
- → What the project needs to install and test: here, Node and npm for acme/api-service.
- → Admin access to the GitHub repository, to add a workflow and its secrets, and Dependabot alerts turned on under **Settings → Code security**.

## Step 1: Make the Workspace and Connect Your Agent

Create a workspace named **api-service**. Its mission tells the agent what it is for, every time it starts:

text

```text
You keep acme/api-service free of known vulnerabilities. When a Dependabot alert
arrives, check whether it is still open and whether a pull request already fixes
it. If not, upgrade the package to the patched version on a new branch, update
the lockfile, run the tests, and open one pull request per alert. Never push to
main. Ask before every git push and gh pr create. If there is no patched version,
or the upgrade is a major version that breaks the tests, do not force it: reply
with what breaks and leave the task for a human.
```

In its settings, set the **Working Directory** to the repository's checkout and leave **YOLO mode** off. Then start the agent you want to wake up on a **machine**: a computer of yours running `agentrqd`, the AgentRQ daemon. If you have none yet, open **Machines**, click **Add machine** and run the two commands it shows on the computer that has the checkout; you do this once, and the machine serves every workspace. Back in the workspace, click the start button, or **Change** under it to open the **Start an agent** form and pick the agent, its model and its effort.

**Claude Code.** Pick **Claude Code**. AgentRQ starts it on the machine with the workspace's channel turned on, which is how a new task reaches the running session. [Connect Claude Code with machines](https://agentrq.com/guidelines/connect-agents/claude-code-and-machines) shows every click.

**Codex, Antigravity, Gemini CLI, GitHub Copilot, Cursor, OpenCode and other ACP agents.** Pick the agent from the list, or click **+** and search for it: every agent in the ACP registry is there. AgentRQ runs it through the ACP Gateway, which keeps the agent's session open, hands it each new task as a prompt over ACP, and restarts the agent if it dies. [Connect agents with the ACP Gateway and machines](https://agentrq.com/guidelines/connect-agents/acp-gateway-and-machines) shows every click.

![The Start an agent form, with the agent list on the left, the Model and Effort columns, and the Start button](https://agentrq.com/assets/guidelines/setting-up-an-agent-4-start-form.png)

If the agent needs signing in, it asks in its live terminal the first time, and you sign in from there. The [ACP setup page for each agent](https://agentrq.com/docs/agents) has its id and quirks. Whichever you pick, the workspace's dot turns green once it is connected, and nothing else in this tutorial changes.

## Step 2: Create the dependabot_alert Event and Its Trigger

Open **Events**, click **+ New Event**, and name it **dependabot_alert**. In its payload guidelines, say what it carries: "Sent by the dependabot-alerts GitHub Actions workflow through the generic hook, once per open Dependabot alert."

On the event's page, click **+ Add Trigger**. **1. api-service gets the task.** **2. One title for every alert:** the generic hook gives no subject, so every task is called "Fix Dependabot alert in api-service", and the alert's number is in the body. **3. The alert goes here:** {{EVENT_PAYLOAD}} becomes the alert the workflow sent. **4. YOLO off**, so the agent asks before every command. **5. Create trigger.**

![Step 2: the New trigger form of the dependabot_alert event, with api-service as the workspace, “Fix Dependabot alert in api-service” as the title, {{EVENT_PAYLOAD}} in the instructions and YOLO mode off, with arrows at each and at Create trigger](https://agentrq.com/assets/tutorials/dependabot-alerts-01-trigger.png)

The instructions are the agent's playbook for an alert. This run used:

text

```text
A Dependabot alert is open in acme/api-service.

{{EVENT_PAYLOAD}}

1. Check the alert is still open: gh api repos/<repository>/dependabot/alerts/<number>.
   If it is fixed or dismissed, reply that and complete the task.
2. Look for an open pull request that already bumps this package
   (gh pr list --search "<package>"). If there is one, reply its link and complete the task.
3. If there is no patched version, reply with the advisory and what you would do
   instead, and leave the task open.
4. Otherwise, on a new branch named deps/<package>-<patched version>, upgrade the
   package to the patched version, update the lockfile, and run the tests.
5. A major version bump, or tests that fail after the upgrade: stop, reply with
   what breaks, and leave the task open.
6. Commit, then push and open a pull request titled "fix(deps): bump <package> to
   <patched version> (Dependabot alert #<number>)", with the advisory link in its description.
7. Reply with the pull request link and complete the task.
```

Steps 1 and 2 matter more than they look. The workflow sends every open alert, so an alert that is already being fixed, or was fixed a minute ago, can still arrive. Checking first makes those tasks end in one line instead of a second pull request.

## Step 3: Register the Generic Hook

Open **Events → Hooks** and choose **New registration**. Name it **dependabot-alerts**. **1. Pick the generic hook.** **2. Generate a token, then Copy it**: the workflow sends it, and it is never shown again. Leave **Header** empty, so the token goes in Authorization as a Bearer token. **3. Route request.received to dependabot_alert.** **4. Create registration.**

![Step 3: the New registration form with the generic hook picked, a generated Token with its Generate and Copy buttons, and request.received routed to dependabot_alert, with arrows at each and at Create registration](https://agentrq.com/assets/tutorials/dependabot-alerts-02-hook-form.png)

The registration's page now shows **1. the payload URL**, with its agentrq_hook_token at the end. **2. Copy URL** now: the full URL is shown only this once. If you lose it, **Rotate token** gives you a new one and the old one stops working.

![Step 3, continued: the dependabot-alerts registration with its payload URL and Copy URL button, and its Deliveries: a Rejected request with a wrong token, a Published one and a Duplicate, with arrows at each](https://agentrq.com/assets/tutorials/dependabot-alerts-03-hook-url-and-deliveries.png)

The **Deliveries** list in the same screenshot is from later in the run: **3. a wrong token is Rejected**, with the reason, **4. the right token makes a task**, and **5. the same alert sent again makes no second task**. Step 4 explains why.

## Step 4: Send the Alerts from GitHub Actions

The workflow needs three repository secrets, under **Settings → Secrets and variables → Actions**:

- → **AGENTRQ_HOOK_URL**: the payload URL from Step 3, token included.
- → **AGENTRQ_HOOK_SECRET**: the token you generated in Step 3.
- → **DEPENDABOT_ALERTS_TOKEN**: a fine-grained personal access token for this repository with **Dependabot alerts: Read-only**. The workflow's own GITHUB_TOKEN cannot read Dependabot alerts.

Then add .github/workflows/dependabot-alerts-to-agentrq.yml:

yaml

```yaml
name: dependabot-alerts-to-agentrq
on:
  schedule:
    - cron: "*/30 * * * *"
  workflow_dispatch:
jobs:
  send:
    runs-on: ubuntu-latest
    steps:
      - name: Send each open Dependabot alert to AgentRQ
        env:
          GH_TOKEN: ${{ secrets.DEPENDABOT_ALERTS_TOKEN }}
          HOOK_URL: ${{ secrets.AGENTRQ_HOOK_URL }}
          HOOK_SECRET: ${{ secrets.AGENTRQ_HOOK_SECRET }}
        run: |
          gh api --paginate "repos/$GITHUB_REPOSITORY/dependabot/alerts?state=open&per_page=100" |
          jq -c '.[]' |
          while read -r alert; do
            number=$(jq -r .number <<<"$alert")
            jq -r --arg repo "$GITHUB_REPOSITORY" '"Dependabot alert #\(.number) in \($repo)
          Severity: \(.security_advisory.severity)
          Package: \(.dependency.package.name) (\(.dependency.package.ecosystem)), in \(.dependency.manifest_path)
          Vulnerable: \(.security_vulnerability.vulnerable_version_range)
          Patched: \(.security_vulnerability.first_patched_version.identifier // "none yet")
          Advisory: \(.security_advisory.ghsa_id), \(.security_advisory.summary)
          Link: \(.html_url)"' <<<"$alert" > alert.txt
            curl -fsS -X POST "$HOOK_URL" \
              -H "Authorization: Bearer $HOOK_SECRET" \
              -H "Content-Type: text/plain" \
              -H "Idempotency-Key: $GITHUB_REPOSITORY#$number" \
              --data-binary @alert.txt
          done
```

Three choices in it are deliberate:

- → **One request per alert, as plain text.** The generic hook passes the body through, and {{EVENT_PAYLOAD}} pastes it into the task as it is. Seven readable lines are easier for the agent, and for you, than a JSON blob on one line.
- → **The Idempotency-Key is the repository and the alert number.** The hook records each key it has seen, so an alert that is still open on the next run, 30 minutes later, is a Duplicate and makes no second task. Keys are kept as long as deliveries, 7 days by default: an alert still open a week later comes back as a fresh task, which works as a reminder, and the playbook's first two checks keep it from becoming a second pull request.
- → **Every 30 minutes.** GitHub runs scheduled workflows on a best-effort basis, so a run can start a few minutes late. Run it by hand with **Run workflow** to send the open alerts now.

Only want the urgent ones? Add `&severity=critical,high` to the API URL.

## Step 5: The Alert Wakes the Agent

The first run found alert #42: lodash 4.17.20 in package-lock.json, Command Injection, fixed in 4.17.21. The hook fired dependabot_alert, and the trigger created the task.

**1. Agent connected:** the green dot next to the workspace's name. **2. The alert, as the workflow sent it**, above the playbook. **3. Not started**, for a moment: AgentRQ hands a waiting task to the connected agent within a minute, and the agent moves it to Ongoing.

![Step 5: the api-service workspace with a green dot, and the not started task “Fix Dependabot alert in api-service” showing Dependabot alert #42, severity high, lodash in package-lock.json, vulnerable below 4.17.21, patched in 4.17.21, advisory GHSA-35jh-r3h4-6jhm and the alert link, with arrows at the dot, the alert and the Not started state](https://agentrq.com/assets/tutorials/dependabot-alerts-04-task-arrives.png)

That is the wake-up. A Claude Code session sitting idle in its terminal gets the task as a new message and starts working. An ACP agent gets it as a new prompt from the gateway. If no agent is connected, the task waits under **Not started** and goes to the agent as soon as one connects, so a laptop that was asleep catches up when it wakes.

A workspace's agent works on one task at a time. When three alerts arrive together, the other two wait under **Not started** and are handed over one after another as each finishes.

## Step 6: You Approve the Push

The agent checked that alert #42 was still open and that no pull request bumped lodash, found the two places lodash 4.17.20 came from, upgraded it on deps/lodash-4.17.21, ran the tests and committed. **1. Tested and committed**, with what it did and the results. **2. The push waits for you**, in an Authorization Required card with the exact command. **3. Allow Once.**

![Step 6: the task's reply with the branch deps/lodash-4.17.21, npm install lodash@4.17.21, npm test 214 passed and npm audit clean, the commit, and an Authorization Required card for git push -u origin deps/lodash-4.17.21 with Allow Once, Always Allow and Deny, with arrows at the commit line, the command and Allow Once](https://agentrq.com/assets/tutorials/dependabot-alerts-05-push-approval.png)

After the push it asked the same way before gh pr create. The cards reach your phone through [notifications](https://agentrq.com/features/real-time-notifications), so an alert at night is a pull request waiting for one tap in the morning. Use **Allow Once**, not **Always Allow**: Always Allow saves a rule, and the next push would not ask.

The card looks the same whichever agent raised it: when Claude Code or an ACP agent asks for permission, the request comes to the task, and with YOLO off AgentRQ never answers one for you.

## Step 7: The Pull Request, and the Alert Closes Itself

**1. You approved twice**, the two Needs input stops on the timeline, and the task is Completed. **2. The pull request**, with what changed, the advisory it fixes and the test run. **3. Linked on the task:** AgentRQ spots the pull request link and lists it under **Links**, next to the alert.

![Step 7: the completed task with two Needs input stops on its timeline, the reply “Pull request opened: https://github.com/acme/api-service/pull/418” with the title fix(deps): bump lodash to 4.17.21 (Dependabot alert #42) and its summary, and pull request #418 under Links, with arrows at each](https://agentrq.com/assets/tutorials/dependabot-alerts-06-pull-request.png)

You review and merge it like any other pull request. Dependabot then sees the patched version on the default branch and closes alert #42 by itself, so the next run of the workflow no longer sends it.

## Real Time on a Self-Hosted Server

On a server you run with AGENTRQ_HOOKS_ALLOW_USER_HOOKS=true, you can drop the schedule and take GitHub's dependabot_alert webhook directly, with a small hook of your own that checks GitHub's signature and fires an event for created and reopened alerts. [Wake Claude on Dependabot alerts](https://agentrq.com/blog/dependabot-alerts-wake-claude-code-agent-with-agentrq-hooks) has its complete Go source, and [write your own hook in WebAssembly](https://agentrq.com/guidelines/hooks/write-your-own-agentrq-hook-in-webassembly) shows how to build and upload it. Route its events to the same dependabot_alert event, add the repository webhook with **Dependabot alerts** ticked, and Steps 1, 2 and 5 to 7 stay exactly as they are.

## Traps to Avoid

- → **The agent is not connected.** Tasks pile up under **Not started**, and nothing wakes. Check for the green dot. An agent started on a machine that stays on, such as a dev box, keeps listening when your laptop is closed.
- → **The wrong token.** The hook answers 202 before it checks anything, so curl in the workflow succeeds and the request shows up only as **Rejected** in the registration's Deliveries, with "missing or wrong token in Authorization".
- → **GITHUB_TOKEN instead of a personal access token.** gh api answers 403 and the workflow sends nothing. Use a token with Dependabot alerts read access.
- → **A changed Idempotency-Key.** Put the run id or a timestamp in it and every run makes a new task for every open alert. Keep it to the repository and the alert number.
- → **One title for every task.** The generic hook has no subject, so the task list shows the same title many times. The alert number is in each task's body; ask the agent to name it in its first reply.
- → **Several repositories, one workspace.** The workspace's working directory is one checkout. Give each repository its own workspace and registration, or point the trigger at a workspace whose agent can reach every checkout.
- → **Always Allow on git push.** It saves a rule by the command's first word, so every git command, push included, runs without asking from then on. Keep Allow Once for anything that leaves your machine.

## Make It Yours

- → **Only critical and high.** Add `&severity=critical,high` to the API URL in the workflow.
- → **One workflow for the whole organization.** Call `orgs/<org>/dependabot/alerts` instead, which lists every repository's alerts with the repository in each, and send each repository's alerts to the payload URL of its own registration, routed to its own workspace.
- → **Group the small ones.** Tell the agent to add a low-severity alert to an open deps pull request instead of opening a new one.
- → **Save the routine as a skill.** Which lockfiles to update, which tests to run and how to title the pull request belong in a [skill](https://agentrq.com/features/distributed-skills) the whole team shares, and what the agent learns about the repository goes into [workspace memory](https://agentrq.com/features/workspace-memory).
- → **Pair it with weekly upgrades.** Alerts cover what is vulnerable today; [weekly dependency upgrades with a scheduled agent](https://agentrq.com/tutorials/weekly-dependency-upgrades-with-a-scheduled-ai-agent-one-grouped-pull-request-and-majors-you-pick) keeps everything else current so the next fix is a small one.

## FAQ

**Does the agent need a public URL?** No. GitHub Actions calls AgentRQ's payload URL. The agent keeps its usual connection to its workspace, and the task comes down that connection.

**Which agents can be woken this way?** Claude Code over its MCP channel, and every agent the ACP Gateway runs, such as Codex, Antigravity, Gemini CLI, GitHub Copilot, Cursor and OpenCode. The hook, event and trigger do not change with the agent; only Step 1 does.

**How fast does the agent wake up?** Within a minute of the task being created. The alert itself can wait up to the workflow's 30 minutes, or arrive at once with your own hook on a self-hosted server.

**Will the same alert make two pull requests?** Not within 7 days, because the Idempotency-Key makes a repeated alert a Duplicate. After that, the playbook's check for an open pull request ends the task in one line.

**Can the agent dismiss alerts?** It could, with your GitHub CLI login, but the playbook never asks it to: dismissing an alert is a judgment call. The playbook leaves a task open for you when there is no patched version or the upgrade breaks the tests.

**Does Dependabot's own pull request make this redundant?** Dependabot security updates open a pull request too, but they do not fix code that breaks with the new version. This setup gives the agent the alert with your repository's tests and rules, and it tells you what breaks when it cannot finish. To fix a failing Dependabot pull request instead, route ci.failed from the github hook for dependabot/* branches, as in [fix a red main build](https://agentrq.com/tutorials/fix-a-red-main-build-with-an-ai-agent-github-ci-failure-to-pull-request).
