A lightweight, explainable retry controller for Airflow tasks using a local Ollama LLM (no cloud calls, no external APIs).
Traditional Airflow retries don’t “know” why a task failed — they’ll blindly retry even for permanent errors like “Table Not Found”.
This plugin introduces intelligent, context-aware retries powered by a local LLM (via Ollama).
When a task fails, Airflow:
- Triggers a custom retry callback
- Sends the task’s error message + context to your local LLM
- The LLM decides:
- ✅ retry – transient error (network, timeout, etc.)
- ❌ no_retry – deterministic error (syntax, missing table)
- If the LLM decides no_retry, the callback immediately sets the task state to
FAILED, preventing further retries.
┌───────────────────────────┐
│ Airflow Task │
│ (fails) │
└─────────────┬──────────────┘
│ on_retry_callback
▼
┌────────────────────┐
│ Smart Retry Logic │
│ (Python callback) │
└─────────┬──────────┘
│
▼
┌─────────────────────┐
│ Local Ollama LLM │
│ (llama3 / mistral) │
└─────────┬───────────┘
│ JSON decision
▼
┌────────────────────────────┐
│ Update task state → FAILED │
│ or allow normal retry │
└────────────────────────────┘
- Apache Airflow ≥ 2.6
- Python ≥ 3.8
- Ollama (local or remote)
ollama pull llama3.1:8b-instruct ollama serve
- Build Docker image:
docker build . --tag airflow_local:latest - Initialize Airflow with Docker Compose:
docker compose up airflow-init
- Start Airflow services:
docker compose up -d
- Stop services:
docker compose down