Autonomous Self-Healing System for Pegasus Scientific Workflows
AgentMape is an intelligent workflow management system based on the MAPE-K architecture (Monitor, Analyze, Plan, Execute, Knowledge). It automatically detects workflow failures, diagnoses root causes using AI, generates repair plans, and can execute fixes autonomously.
AgentMape implements a closed-loop autonomic computing cycle that monitors Pegasus workflows, analyzes failures using Large Language Models (LLMs), generates executable repair plans, and learns from successful repairs.
┌─────────────┐
│ Monitor │ ──> Detects workflow failures (held/failed jobs)
└──────┬──────┘
│
↓
┌─────────────┐
│ Analyze │ ──> Diagnoses root cause using LLM + pegasus-analyzer
└──────┬──────┘
│
↓
┌─────────────┐
│ Plan │ ──> Generates executable repair plan with LLM
└──────┬──────┘
│
↓
┌─────────────┐
│ Execute │ ──> Executes approved repair commands
└──────┬──────┘
│
↓
┌─────────────┐
│ Knowledge │ ──> Learns from successful repairs
└─────────────┘
- Port: 8080
- Location: Monitoring/
- Purpose: Continuously monitors Pegasus workflows
- Capabilities:
- Detects held/failed/running workflow states
- Tracks workflow statistics
- Triggers analysis when failures occur
- WebSocket + REST API interfaces
- Auto-pushes failures to Analyzer
- Port: 8081
- Location: Analyzer/
- Purpose: Root cause analysis using AI
- Capabilities:
- Runs
pegasus-analyzeron failed workflows - Sends logs to Ollama LLM (glm-4.6:cloud model)
- Extracts structured problem diagnosis
- Identifies error levels (replica, site, transformation catalogs)
- Sends analysis results to Planner via webhook
- Catalog-aware (detects embedded vs. separate catalogs)
- Runs
- Port: 8082
- Location: Planner/
- Purpose: Generates executable repair plans
- Capabilities:
- Receives analysis from Analyzer
- Generates repair plans using LLM (llama3:latest)
- Creates bash/Pegasus commands to fix issues
- Risk assessment (low/medium/high)
- Auto-approves low-risk plans (confidence > 0.75)
- Catalog-aware repairs (text vs YAML catalogs)
- Includes rollback strategies
- Port: 8085
- Location: Dashboard/
- Purpose: Real-time monitoring UI
- Capabilities:
- Displays status of all agents (Monitor, Analyzer, Planner)
- Shows workflow statistics (Running, Failed, Held, Success)
- Lists recent workflows
- Auto-refreshes every 3 seconds
- Terminal-style interface with colors
- Location: WorkflowValidator/
- Purpose: Pre-submission workflow validation
- Capabilities:
- Validates YAML workflows
- Generates YAML from Python descriptors
- Python syntax validation
- Security checks
- Path integrity validation
- LLM-assisted analysis
- Supports generator scripts
- Location: PegasusProvider/
- Purpose: Pegasus command execution service
- Capabilities:
- Provides Pegasus integrity checks
- Command execution interface
# Clone the repository
cd AgentMape
# Install dependencies for each component
pip install -r Monitoring/requirements.txt
pip install -r Analyzer/requirements.txt
pip install -r Planner/requirements.txt
pip install -r Dashboard/requirements.txt
pip install -r WorkflowValidator/requirements.txtOption 1: Use the startup script
./start_system.shOption 2: Start agents individually
# Terminal 1: Monitor
cd Monitoring
python server_rest.py
# Terminal 2: Analyzer
cd Analyzer
python analyzer_rest.py
# Terminal 3: Planner
cd Planner
python planner_rest.py
# Terminal 4: Dashboard
cd Dashboard
python dashboard_server.pyOpen your browser and navigate to:
http://localhost:8085
- Monitor detects a held workflow (
condor_qshows held job) - Monitor pushes failure to Analyzer
- Analyzer:
- Runs
pegasus-analyzeron workflow directory - Gets error:
"Input file 'data.csv' not found" - Sends logs to Ollama LLM
- LLM identifies: "Missing replica catalog entry"
- Sends structured analysis to Planner
- Runs
- Planner:
- Receives analysis with catalog info
- Generates plan with LLM:
Step 1: cp /workflow/rc.txt /workflow/rc.txt.backup Step 2: echo 'data.csv file:///data/input.csv local' >> /workflow/rc.txt Step 3: pegasus-run /workflow/dir
- Risk: LOW, Confidence: 0.92
- Auto-approves for execution
- Executor (planned): Executes the repair commands
- Workflow resumes successfully
- Python - All agents implemented in Python
- Flask - REST API framework
- WebSocket - Real-time Monitor communication
- Ollama - LLM backend (via Pinggy tunnel)
- Analyzer:
glm-4.6:cloud - Planner:
llama3:latest
- Analyzer:
- TinyDB - Lightweight database for agents
- Pegasus WMS - Workflow management system
- HTCondor - Job scheduling system
The system understands Pegasus catalog types:
- Text catalogs (
rc.txt,tc.txt) - Usesechocommands - YAML catalogs (embedded) - Uses
yqcommands - XML catalogs - Uses
xmlstarletcommands
Plans are automatically categorized:
- Low risk: Auto-execute (e.g., add replica entry)
- Medium risk: Notify + require approval (e.g., increase memory)
- High risk: Manual review required (e.g., dangerous commands)
- Dangerous command detection (
rm -rf,dd) - Confidence threshold validation
- Rollback strategies required
- Command syntax verification
Each agent has a JSON configuration file:
Monitoring/monitor_config.json- Monitor settings and portsAnalyzer/analyzer_config.json- Analyzer + Ollama configurationPlanner/planner_config.json- Planner + Ollama configurationWorkflowValidator/validator_config.json- Validator settings
Example configuration (Monitor):
{
"http_port": 8080,
"mcp_port": 8765,
"analyzer_url": "http://localhost:8081",
"planner_url": "http://localhost:8082",
"monitor_interval": 60,
"auto_analysis_enabled": true
}GET /health- Health checkGET /api/workflows- List workflowsGET /api/workflows/{id}- Get workflow detailsPOST /api/workflows/{id}/analyze- Trigger analysis
GET /health- Health checkPOST /api/analyze- Manually trigger analysisGET /api/analyses- List all analysesGET /api/analyses/{id}- Get specific analysis
GET /health- Health checkPOST /api/create-plan- Manually create planGET /api/plans- List all plansGET /api/plans/{id}- Get specific planPOST /api/plans/{id}/approve- Approve plan
GET /- Dashboard UIGET /api/data- All data (agents + workflows)GET /api/agents- Agent status onlyGET /api/workflows- Workflow statistics
# Validate YAML workflow
python WorkflowValidator/cli.py workflow.yml
# Generate YAML from Python descriptor
python WorkflowValidator/cli.py workflow_descriptor.py
# Validate with custom workflow directory
python WorkflowValidator/cli.py orchestrator.py --workflow-dir /path/to/workflow/
# Validate generator scripts
python WorkflowValidator/cli.py generate.py --from-generator --workflow-args 'production 4'AgentMape/
├── Monitoring/ # Monitor agent (workflow detection)
├── Analyzer/ # Analyzer agent (root cause analysis)
├── Planner/ # Planner agent (repair plan generation)
├── Dashboard/ # Real-time monitoring dashboard
├── WorkflowValidator/ # Workflow validation tool
├── PegasusProvider/ # Pegasus command execution service
├── start_system.sh # System startup script
├── stop_system.sh # System shutdown script
└── README.md # This file
✅ Implemented:
- Monitor agent with workflow detection
- Analyzer agent with LLM-powered diagnosis
- Planner agent with LLM-powered repair generation
- Real-time Dashboard
- Workflow Validator
🚧 Planned:
- Executor agent (automatic repair execution)
- Knowledge base (learning from repairs)
- Feedback loop improvements
- Verify agent is running:
curl http://localhost:PORT/health - Check agent logs in their respective directories
- Verify port configuration in config files
- Check
ollama_urlinanalyzer_config.jsonandplanner_config.json - Verify Pinggy tunnel is active
- Test Ollama endpoint:
curl [ollama_url]/api/generate
- Ensure Monitor is configured with correct Pegasus workflow directory
- Check HTCondor is running:
condor_q - Verify workflow is submitted to HTCondor
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly with real Pegasus workflows
- Submit a pull request
[Add your license information here]
[Add contact information here]
AgentMape - Bringing autonomous intelligence to scientific workflow management