Log icon
StructuredOutputCompletion icon
SlackIncomingWebhook icon
If icon
PagerDutyAlert icon

AI Incident Triager with Gemini, PagerDuty, and Slack

Automate incident triage with Gemini structured outputs, broadcasting root-cause analysis to Slack and paging on-call engineers via PagerDuty.

Categories
AIInfrastructure

Production incidents demand rapid diagnostics, but manual triage of raw stack traces and error logs creates delays and escalates alert fatigue. This blueprint implements an automated, AI-assisted incident triage pipeline that parses raw error logs with Google Gemini, outputs structured root-cause hypotheses, broadcasts real-time findings to Slack, and conditionally triggers PagerDuty alerts for critical service disruptions.

How it works

  1. Log Reception: The flow accepts incoming incident details including the affected service name, initial severity hint, and raw error stack traces.
  2. Gemini Structured Analysis: The gemini_root_cause_analysis task (io.kestra.plugin.gemini.StructuredOutputCompletion) analyzes the raw error logs against strict JSON schema definitions to extract a summary, root cause hypothesis, actionable recovery steps, and an escalation verdict.
  3. Slack War Room Broadcast: The notify_slack_channel task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) formats the structured findings and posts them directly to the incident response channel.
  4. Conditional Escalation: The check_and_escalate task (io.kestra.plugin.core.flow.If) evaluates whether the AI identified critical impact or if the initial alert was flagged as CRITICAL. When triggered, it creates a deduplicated incident in PagerDuty via trigger_pagerduty_incident (io.kestra.plugin.pagerduty.PagerDutyAlert).
  5. Pipeline Resilience: An errors block ensures a dead-letter notification is immediately dispatched to Slack if the triage pipeline encounters an unhandled exception.

What you get

  • Sub-second root cause diagnosis from raw logs without manual intervention.
  • Zero glue-code JSON schema enforcement with Gemini structured outputs.
  • Automatic deduplicated paging to PagerDuty only when human intervention is truly necessary.
  • Dead-letter error handling guaranteeing observability over the triage pipeline itself.

Who it's for

  • Site Reliability Engineers (SREs) and DevOps teams managing on-call rotations.
  • Platform teams seeking to reduce Mean Time to Resolution (MTTR) and alert noise.
  • Incident response coordinators needing consistent, structured incident briefing notes.

Why orchestrate this with Kestra

Kestra natively handles retry policies, secret protection, native AI plugin execution, and conditional logic in declarative YAML. By using native Gemini, Slack, and PagerDuty plugins, no custom container builds or external scripts are required.

Prerequisites

  • A Google Gemini API key.
  • A Slack Incoming Webhook URL.
  • A PagerDuty technical service with an Events API v2 integration key.

Secrets

  • GEMINI_API_KEY: API key for Google Gemini model inference.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for incident announcements.
  • PAGERDUTY_ROUTING_KEY: 32-character PagerDuty Events API v2 Integration Key.

Quick start

  1. Configure GEMINI_API_KEY, SLACK_WEBHOOK_URL, and PAGERDUTY_ROUTING_KEY in your Kestra namespace secrets.
  2. Execute this flow with the default input values to verify the triage and notification output.
  3. Connect your monitoring tools (Prometheus Alertmanager, Datadog, or Grafana) to trigger this flow on alert creation.

How to extend

  • Add automated remediation actions (e.g. restart Kubernetes deployment or flush cache) in the escalation branch.
  • Integrate vector search or historical incident databases to cross-reference previous incident post-mortems.
  • Route non-critical findings into Jira Service Management or Linear tickets.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.