> Index of all Nori docs pages for agents: https://docs.noriagentic.com/llms.txt · Ask a question: https://noriagentic.com/ask

# How to have an agent triage Sentry errors and open a fix PR

Yes. Create a **From a webhook** automation in Nori and add its URL to a Sentry internal integration used as an alert rule action. Each time the alert fires, Nori starts a coding agent on a fresh machine with your repositories and the alert payload; the agent reproduces the error, opens a fix pull request, and asks for review in a Slack thread. Your branch protection decides what merges.

## Prerequisites

- The [GitHub App](https://docs.noriagentic.com/sessions/guides/github/) installed, with the affected repositories added under **Settings → Environment**.
- A connected agent (Claude Code, Codex, or another harness) under **Integrations → Token providers**.
- The [Nori Slack app](https://docs.noriagentic.com/sessions/guides/slack/) installed and the bot invited to the alerts channel, for example `#eng-alerts`, plus its channel ID.
- Optional but recommended: the **Sentry** MCP server from the catalog (**Integrations → MCPs**, OAuth sign-in), so the agent can read the full issue and event history, not only the payload. See [MCP servers](https://docs.noriagentic.com/sessions/guides/integrations/#mcp-servers).
- In Sentry, permission to create an internal integration and alert rules.

## Steps

1. In Nori, open **Automations** → **New automation**. Name it, for example `Sentry alert to fix PR`.
2. Under **Starts when**, choose **From a webhook**.
3. Write the **Instructions** (see the example). Nori appends each webhook’s JSON payload to them and marks it as untrusted data.
4. Under **Deliver to**, choose **Slack thread** and enter the `#eng-alerts` channel ID.
5. Save with **Create**, or **Submit for approval** if you are a member.
6. Open the saved automation and use **Copy webhook URL**. It has the form `https://<org>.norisessions.com/api/webhook/<automation-id>`. Anyone with the URL can start a run, so keep it private.
7. In Sentry, go to **Settings → Developer Settings** and create an internal integration. Paste the Nori URL as its webhook URL, turn on **Alert Action**, and save.
8. In Sentry **Alerts**, create an issue alert for the project, for example “A new issue is created” in `production`, with the action **Send a notification via** your new integration. Start with one project.

## Example

Automation instructions:

```text
A Sentry alert fired; the payload is attached.

1. Identify the repository from the release and the culprit path.
2. If the Sentry MCP server is connected, read the full issue and the latest
   event.
3. Find the commit that most likely introduced the error.
4. Write a failing test that reproduces it.
5. If the cause is clear and the fix is small, fix it on a new branch, run the
   test suite, and open a pull request that links the Sentry issue.
   Never merge.
6. If the cause is unclear or the code is under payments/ or auth/, open no
   pull request; report what you found instead.

Reply with: cause, PR link (or why there is none), tests run, and what the
reviewer should check.
```

The same automation from the CLI:

```bash
nori-sessions triggers create --name "Sentry alert to fix PR" --type webhook \
  --slack-channel-id C0123456789 --prompt "$(cat sentry-prompt.txt)"
```

## Verify it works

1. On the automation, choose **Run now** and paste a sample Sentry payload into **Optional JSON payload** (CLI: `nori-sessions triggers test --id <id> --payload '<json>'`).
2. Check that a thread opens in `#eng-alerts` and that the reply names the right repository.
3. In Sentry, send a test notification from the alert rule. The automation’s **Recent activity** shows **Latest webhook payload** with Sentry’s body.
4. When a real alert produces a pull request, review it like any other. Reply in the Slack thread to ask for changes; the same agent continues.

Each delivery queues separately (up to 10 waiting), so an alert storm does not start unlimited runs. See [the queue and retries](https://docs.noriagentic.com/sessions/guides/triggers/#the-queue-and-retries).
