Flow icon
Webhook icon
Log icon
Commands icon
Docker icon
SlackIncomingWebhook icon

AI-Assisted Workflow Failure Triage

Advisory failure triage classifying Kestra execution errors, scrubbing secrets, and generating troubleshooting next steps in Slack.

Categories
AI

Orchestrate an advisory AI-assisted workflow failure triage pipeline that listens for failed Kestra executions, automatically extracts error stack traces, redacts sensitive credentials and PII, classifies the root cause category using LangChain, and delivers actionable troubleshooting steps directly to on-call engineering Slack channels.

When production data pipelines and cloud workflows fail in the middle of the night, on-call engineers waste valuable time parsing noisy stack traces and logs. This blueprint provides an automated, advisory diagnostic assistant:

  1. Automated Failure Ingestion: Listens to execution status transitions (FAILED) via Kestra's Flow trigger with dependsOn or accepts manual triage webhooks.
  2. Secret Scrubbing & PII Redaction (redact_sensitive_error_logs): Automatically strips Authorization tokens, passwords, bearer credentials, database connection strings, and emails before sending logs to LLMs.
  3. LLM Diagnostic Classification (llm_root_cause_diagnosis): Classifies the failure into structured categories (network timeouts, schema mismatches, null evaluations, permission errors) and outlines safe, advisory next steps.
  4. Advisory Team Dispatch (notify_slack_advisory_card): Delivers an executive diagnosis card directly to Slack. The workflow remains strictly advisory and never executes unauthorized production fixes.

How it works

  1. Triggering:
    • The on_failure trigger (io.kestra.plugin.core.trigger.Flow) uses dependsOn with states: [FAILED] on the target namespace company.team, automatically mapping {{ trigger.executionId }}, {{ trigger.flowId }}, and {{ trigger.namespace }} into the flow's inputs.
    • The inbound_failure_webhook trigger (io.kestra.plugin.core.trigger.Webhook) allows external monitoring tools or manual developer triggers to request failure triage directly.
  2. Sanitization (redact_sensitive_error_logs):
    • Runs inside a sandboxed Python Docker container (python:3.11-slim) to sanitize sensitive tokens from the stack trace.
  3. AI Root Cause Synthesis (llm_root_cause_diagnosis):
    • Evaluates the failure context using LangChain / Gemini models, generating a categorized failure summary with bulleted action steps.
  4. Slack Notification (notify_slack_advisory_card):
    • Sends formatted diagnostic summaries to developers with zero delay.

What you get

  • Automated error classification accelerating mean-time-to-resolution (MTTR).
  • Regex and keyword secret redaction preventing credential leakage to AI providers.
  • Advisory-only safety guardrails preventing hallucinated automated state mutations.
  • Real-time Slack notifications with actionable next steps.

Who it's for

  • On-call DevOps, SRE, and Platform Engineers troubleshooting production pipeline failures.
  • Data Engineers maintaining complex dbt, Airbyte, and warehouse pipelines.
  • Engineering Managers monitoring error trends across team namespaces.

Prerequisites

  • Docker daemon accessible to Kestra for containerized execution.
  • Slack Incoming Webhook URL configured in Kestra secrets.

Secrets

  • FAILURE_TRIAGE_WEBHOOK_KEY: Secret key for inbound failure webhooks.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint for team alerts.
  • GEMINI_API_KEY or OPENAI_API_KEY: API keys for foundational model access.

Inputs

Name Type Default Description
failed_namespace STRING company.team Namespace of the failed workflow.
failed_flow_id STRING customer-billing-sync Identifier of the failed workflow.
failed_execution_id STRING exec-928192a Failed execution identifier.
error_stack_trace STRING Error log trace Raw error message or exception trace.
diagnosis_model SELECT gemini-2.5-flash LLM model (gemini-2.5-flash, gpt-4o-mini).

Quick start runbook

  1. Configure secrets SLACK_WEBHOOK_URL and GEMINI_API_KEY in your Kestra namespace.
  2. Trigger the flow manually with a sample error stack trace to observe log sanitization and AI root cause diagnosis.
  3. Connect the flow trigger to your production namespace to automatically receive triage cards whenever a flow fails.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.