New to Kestra?
Use blueprints to kickstart your first workflows.
Turn cryptic Kestra failure logs into plain-English explanations with OpenAI and post them to Slack, cutting mean time to resolution for data and platform teams.
Stack traces tell you what broke, rarely why. This blueprint wires an OpenAI Large Language Model into Kestra's error handling so that whenever a task fails, the model reads the real error logs, explains the likely cause in plain language, and pushes that explanation straight to Slack. Engineers open the alert and already know what went wrong, no log spelunking required. It is a practical pattern for AI-assisted observability, automated debugging, and faster incident response.
bad_python_task task (io.kestra.plugin.scripts.python.Script) runs a Python snippet that intentionally fails, standing in for any real task that can error.errors block instead of stopping silently.ai task (io.kestra.plugin.openai.ChatCompletion) sends the failure context to the gpt-4o model, passing the captured logs via {{ errorLogs() }} in its prompt. The prompt instructs the model to reply in clean plain text with no Markdown so the output renders cleanly downstream.alert task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts a message that names the failed flow and execution and embeds the AI explanation read from {{ outputs.ai.choices[0].message.content }}.Kestra's declarative YAML lets you attach this AI explanation step as a flow-level errors handler that fires automatically on failure, with no glue code. You get retries, full execution lineage, and event-driven triggers across every task. OpenAI's API has no scheduler, no error context, and no notion of your pipeline; Kestra supplies the failure event, the captured logs, and the delivery to Slack, turning a standalone model call into an operational safety net.
gpt-4o.OPENAI_API_KEY: API key used by the ChatCompletion task.SLACK_WEBHOOK_URL: incoming webhook URL used by the Slack task.OPENAI_API_KEY and SLACK_WEBHOOK_URL secrets to your Kestra instance.errors block.bad_python_task with your real tasks and reuse the errors block as-is.gpt-4o for another model, or tune the prompt to request remediation steps or severity scoring.