An open-source, autonomous Red vs. Blue vs. Purple agentic framework for Kubernetes security hardening and self-healing.
AIRA (Autonomous Infrastructure Resilience Architecture) is a multi-agent resilience platform. It combines autonomous security penetration/patching (SentinelArena) with ML-driven system anomaly detection and auto-remediation (NeuralOps), connected through a unified bridge.
AIRA operates as a continuous closed-loop system:
- ๐ด Red Agent identifies and exploits vulnerabilities across the cluster
- ๐ต Blue Agent dynamically implements patches, NetworkPolicies, and security baselines
- ๐ฃ Purple Agent synthesizes battle patterns into actionable security posture reports
- ๐ง NeuralOps predicts container failures and heals workloads before they crash
- ๐ Bridge connects SentinelArena and NeuralOps for cross-system intelligence sharing
graph TD
subgraph SentinelArena ["โ๏ธ SentinelArena โ Red vs Blue vs Purple"]
RedAgent["๐ด Red Agent"] -->|Exploit| WorkloadPod["Vulnerable Workloads"]
Scanner["Scanner"] -->|Alerts| BlueAgent["๐ต Blue Agent"]
BlueAgent -->|Patches| WorkloadPod
PurpleAgent["๐ฃ Purple Agent"] -.->|Post-Battle Analysis| Report["Security Posture Report"]
end
subgraph NeuralOps ["๐ง NeuralOps โ Self-Healing"]
Prometheus["Prometheus"] -->|Metrics| LSTM["LSTM Predictor"]
LSTM -->|Anomalies| Orchestrator["Orchestrator Loop"]
Orchestrator -->|Heal| HealingAgent["Healing Agent"]
HealingAgent -->|Remediation| WorkloadPod
end
Bridge["๐ AIRA Bridge"]
RedAgent -->|Attack Success| Bridge
Bridge -->|Priority Flag| Orchestrator
Orchestrator -->|Anomaly Alert| Bridge
Bridge -->|Pre-emptive Intel| BlueAgent
WorkloadPod -->|Trajectories| SqliteStore[("SQLite Unified DB")]
SqliteStore -->|SFT Prep| SFTDataset["sft_dataset.jsonl"]
SFTDataset -->|QLoRA Fine-Tuning| GemmaModel["Gemma 4 E4B"]
- Red Agent: LLM-powered adversarial attacker that chains CVE/RBAC/Secret/Network exploits, governed by OPA policy enforcement.
- Blue Agent: Autonomous defender that patches vulnerabilities, rotates secrets, and applies NetworkPolicies โ both reactively and pre-emptively.
- Purple Agent: End-of-battle meta-observer that analyzes the full attack/defense timeline and generates a structured Security Posture Report with pattern synthesis, blind spot identification, and prioritized remediation recommendations.
- Safety Orchestrator: OPA-based governance layer with kill switch, escalation detection, spiral breaking, and rate limiting.
- LSTM Anomaly Predictor: Trained on container telemetry (CPU, memory, disk, network) to predict failures before they happen.
- Orchestrator Loop: Continuously monitors pods via Prometheus, runs LSTM inference, and dispatches the healing agent when anomalies are detected.
- Healing Agent: LangGraph-powered remediation pipeline with tiered autonomy (auto-execute / notify / escalate to human).
- Remediation Catalog: Pre-defined healing strategies for memory leaks, CPU throttles, cascading timeouts, and disk pressure.
- AIRA Bridge: Bidirectional integration between SentinelArena and NeuralOps โ Red attack success flags pods for priority NeuralOps monitoring; NeuralOps anomaly alerts feed into Blue Agent's defense prioritization.
- Unified Trajectory Exporter: SQLite-backed trajectory database that formats multi-turn agent interactions into Hugging Face ChatML datasets for SFT training.
- Gemma 4 QLoRA Pipeline: 4-bit QLoRA fine-tuning scripts optimized for
google/gemma-4-e4b-iton standard cloud GPUs (Kaggle T4/Colab T4). - Automated Evaluation: 50-prompt comparative benchmark (base vs. fine-tuned) measuring JSON parse rate, schema compliance, action validity, OPA compliance, and latency.
- Docker Desktop
- Kind (Kubernetes in Docker)
- kubectl
- Python 3.10+
# Create Kind cluster
kind create cluster --name aira-cluster --config infra/kind-config.yaml
# Apply vulnerable demo workloads
kubectl apply -f infra/demo-services/Copy .env.template to .env and configure your keys:
GEMINI_API_KEY=your_gemini_api_key_here
AIRA_LIVE_SCAN=true
AIRA_LLM_BACKEND=geminiRun a multi-round Red vs. Blue battle with Purple Agent report at the end:
python sentinel/main.py --rounds 5Start the self-healing monitoring loop:
# Single scan pass
python -m neuralops.orchestrator.orchestrator --once
# Continuous monitoring (30s interval, 10 cycles)
python -m neuralops.orchestrator.orchestrator --interval 30 --max-iterations 10Launch a multi-campaign run to generate SFT training data:
python sentinel/run_campaign.py --campaigns 40 --battles 2 --rounds 5- Export the Dataset:
python training/export_trajectories.py --output training/sft_dataset.jsonl --augment 5000 python training/test_exporter.py
- Train on Kaggle/Colab:
Upload
sft_dataset.jsonlwith finetune_gemma.ipynb to Kaggle, configure yourHF_TOKENsecret, and run the pipeline. - Verify Adapter Weights:
python training/inspect_lora_keys.py - Evaluation:
Outputs a comparative table to
.\run_eval.batdocs/eval_report_base_vs_finetuned.md.
AIRA/
โโโ sentinel/ # SentinelArena module
โ โโโ agents/ # Red, Blue, Purple agent nodes
โ โโโ graph/ # LangGraph arena topology
โ โโโ governance/ # OPA policy engine
โ โโโ tools/ # kubectl, scanner integrations
โ โโโ main.py # Battle entry point
โโโ neuralops/ # NeuralOps self-healing module
โ โโโ prediction/ # LSTM model, inference pipeline, Prometheus fetcher
โ โโโ orchestrator/ # Main monitoring loop
โ โโโ agent/ # Healing agent (LangGraph pipeline)
โ โโโ config.py # NeuralOps settings
โโโ core/ # Shared services
โ โโโ bridge.py # SentinelArena โ NeuralOps bridge
โ โโโ unified_memory.py # SQLite/PostgreSQL memory store
โ โโโ llm_client.py # Multi-backend LLM client
โโโ training/ # SFT pipeline
โ โโโ export_trajectories.py # Trajectory โ ChatML exporter
โ โโโ finetune_gemma.ipynb # QLoRA training notebook
โ โโโ Modelfile # Ollama model definition
โ โโโ sft_dataset.jsonl # Training data (6,086 samples)
โโโ infra/ # Kubernetes infrastructure
โ โโโ kind-config.yaml # Kind cluster config
โ โโโ demo-services/ # Vulnerable workload manifests
โโโ dashboard/ # Real-time monitoring UI
- Reinforcement Learning Agent: Replace SFT with RLHF/DPO to enable agents to learn optimal attack/defense strategies through reward signals rather than imitation.
- Real Cluster Deployment: Move from mock/Kind clusters to production-grade K8s with live Prometheus, Falco, and Jaeger integration.
- Multi-Generation Self-Improvement: Run multiple SFT generations (campaign โ train โ deploy โ campaign) and track agent improvement curves.
- Domain Expansion: Extend beyond Kubernetes to cloud IAM, CI/CD pipelines, and network infrastructure.
AIRA is open-source software licensed under the Apache 2.0 License.