Skip to content

ivanvanderbyl/sentry-autofix

Repository files navigation

sentry-agent

Autonomous Sentry issue remediation agent built with Google ADK-Go.

Receives Sentry error events via webhook, analyzes the error, searches the codebase for context, plans and implements a fix in an isolated sandbox, opens a PR, and monitors for regressions — all autonomously. Communicates via Slack.

Architecture

Sentry Webhook → Triage → Code Search → Plan → Fix → PR → Slack Notification
                                                              ↑
GitHub PR Merged Webhook → Mark Resolved → Monitor Regressions

Agent Pipeline (Sequential)

Agent Role Tools Output
TriageAgent Analyze Sentry event, extract stacktrace get_sentry_event, update_issue_status triage
CodeSearchAgent Search repo for error context search_code, search_code_github, read_file, list_files code_context
PlanAgent Plan minimal fix (LLM reasoning only) fix_plan
FixAgent Edit files in sandbox read_file, write_file, search_code, get_diff, commit_and_push fix_result
PRAgent Create PR, notify Slack create_pull_request, slack_post, update_issue_status pr_result

Lifecycle

  1. Sentry fires webhook on new issue → agent creates tracking entry + Slack thread
  2. Pipeline runs: triage → search → plan → fix → PR
  3. GitHub fires webhook when PR is merged → agent resolves Sentry issue
  4. If Sentry fires a regression webhook → agent notifies Slack

Setup

Prerequisites

  • Go 1.21+
  • A Gemini API key
  • Sentry auth token + organization
  • GitHub personal access token (repo scope)
  • Slack bot token (chat:write scope)

Configuration

cp .env.example .env
# Edit .env with your credentials

Key: REPO_MAPPING maps Sentry project slugs to GitHub repository names:

{"my-sentry-project": "my-github-repo"}

Build & Run

make build
make run

Install as systemd service

make install-service
sudo systemctl start sentry-agent
make logs  # follow logs

Webhook URLs

Configure these in Sentry and GitHub:

Service URL Events
Sentry https://your-host:8080/webhooks/sentry Issue alerts
GitHub https://your-host:8080/webhooks/github Pull request events

API

  • GET /health — health check
  • GET /issues — list tracked issues (optional ?status=pr_open&limit=50)
  • POST /webhooks/sentry — Sentry webhook receiver
  • POST /webhooks/github — GitHub webhook receiver

About

Sentry triage agent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors