Multi-Agent System Overview
ASRO implements a sophisticated multi-agent architecture where five specialized agents collaborate to optimize HPC cluster resources. Each agent has distinct responsibilities, operates autonomously, and communicates through well-defined protocols. This modular design enables independent scaling, fault isolation, and maintainability.
Design Principles
๐ฏ Single Responsibility
Each agent focuses on one aspect of optimization
๐ Autonomous Operation
Agents make decisions independently within their domain
๐ค Collaborative Intelligence
Agents share information to achieve system-wide goals
โก Fault Isolation
Agent failures don't cascade to the entire system
Monitor Agent
Eyes on the Cluster
Overview
The Monitor Agent serves as the sensory system of ASRO, continuously collecting and processing resource utilization metrics from across the HPC cluster. It validates resource allocations, detects anomalies in real-time, and triggers alerts when issues are identified.
Internal Architecture
60s interval] Collector[Metrics Collector] Validator[GPU Binding Validator] Anomaly[Anomaly Detector
Threshold-based] Aggregator[Data Aggregator] Publisher[Event Publisher] end subgraph "External Systems" Prom[Prometheus
Metrics DB] Slurm[Slurm API
sacct/scontrol] Nodes[Compute Nodes
nvidia-smi/htop] end subgraph "Data Storage" TSDB[Time-Series DB] Cache[Redis Cache] end subgraph "Communication" Kafka[Kafka Topics] end Scheduler -->|Trigger| Collector Collector -->|Query| Prom Collector -->|Query| Slurm Collector -->|SSH Execute| Nodes Collector -->|Raw Metrics| Validator Collector -->|Raw Metrics| Anomaly Validator -->|Binding Status| Aggregator Anomaly -->|Anomaly Events| Aggregator Aggregator -->|Store| TSDB Aggregator -->|Cache Hot Data| Cache Aggregator -->|Package Events| Publisher Publisher -->|Publish| Kafka style Scheduler fill:#e8f4f8 style Collector fill:#66c2a5 style Validator fill:#66c2a5 style Anomaly fill:#fc8d62 style Aggregator fill:#66c2a5 style Publisher fill:#ffd92f
Key Responsibilities
๐ Metric Collection
- Query Prometheus for GPU, CPU, memory, network metrics every 60 seconds
- Execute nvidia-smi on compute nodes to validate GPU utilization
- Collect Slurm job state and resource allocation data via sacct
- Aggregate metrics across multiple data sources
๐ Resource Validation
- Cross-check GPU assignments with actual process bindings
- Verify CUDA_VISIBLE_DEVICES matches Slurm allocation
- Detect jobs accessing GPUs outside their allocation
- Identify misconfigured containers or runtimes
โ ๏ธ Anomaly Detection
- Compare current metrics against expected baselines
- Flag sustained underutilization (< 30% for > 15 minutes)
- Detect sudden performance degradations
- Identify resource contention patterns
๐ก Event Publishing
- Publish anomaly events to Kafka monitoring topic
- Send real-time alerts for critical issues
- Provide metric snapshots to other agents on request
- Maintain event sequence and timestamps
Interfaces
| Interface Type | Protocol | Purpose |
|---|---|---|
| Prometheus Query API | HTTP/REST | Fetch time-series metrics |
| Slurm REST API | slurmrestd | Query job and node state |
| Compute Nodes | SSH + nvidia-smi/htop | Real-time resource checks |
| Event Bus | Kafka Producer | Publish monitoring events |
| gRPC Service | gRPC | Respond to metric queries from other agents |
Data Flow
Cluster Metrics] -->|Query every 60s| M[Monitor Agent] B[Slurm
Job Data] -->|API Call| M C[Compute Nodes
Live Stats] -->|SSH Check| M M -->|Process & Validate| D{Anomaly?} D -->|Yes| E[Kafka Event:
Anomaly Detected] D -->|No| F[Update Metrics DB] E --> G[Profiler Agent] E --> H[Planner Agent] F --> I[Dashboard
Visualization] style M fill:#66c2a5,stroke:#4a9d88,stroke-width:3px style E fill:#fc8d62,stroke:#e67451,stroke-width:2px
Implementation Details
Technology Stack
- Language: Python 3.11+
- Metrics: Prometheus Python Client
- SSH: Paramiko for remote execution
- Messaging: kafka-python
- Async: asyncio for concurrent polling
Performance Characteristics
- Polling Interval: 60 seconds (configurable)
- Latency: < 5 seconds per poll cycle
- Scalability: Handles 10,000+ nodes
- Concurrency: 50 parallel metric queries
Profiler Agent
Learning from History
Overview
The Profiler Agent builds and maintains historical resource usage profiles for jobs, users, and workload types. It analyzes long-term trends, identifies patterns, and predicts expected resource needs to inform optimization decisions.
Internal Architecture
90-day window] Stats[Statistical Analyzer
Mean/Percentiles] Pattern[Pattern Recognizer
ML-based] Predict[Resource Predictor] ProfileDB[Profile Manager] end subgraph "Data Sources" Kafka[Kafka Events] Slurm[Slurm Accounting
sacct history] TSDB[Time-Series DB] end subgraph "Storage" Redis[Redis
Hot Profiles] Postgres[PostgreSQL
Historical Profiles] end subgraph "Consumers" Planner[Planner Agent] Dashboard[Web Dashboard] end Kafka -->|Stream| Ingest Slurm -->|Batch Load| Historical TSDB -->|Query| Historical Ingest -->|Recent Events| Stats Historical -->|Historical Data| Stats Stats -->|Patterns| Pattern Pattern -->|Features| Predict Predict -->|Update| ProfileDB Stats -->|Store| ProfileDB ProfileDB -->|Cache| Redis ProfileDB -->|Persist| Postgres Redis -->|Query| Planner Redis -->|API| Dashboard style Ingest fill:#fc8d62 style Stats fill:#fc8d62 style Pattern fill:#8da0cb style Predict fill:#8da0cb style ProfileDB fill:#fc8d62
Key Responsibilities
๐ Data Aggregation
- Collect 90 days of Slurm accounting data for each job
- Aggregate metrics by job ID, user, and workload type
- Process real-time events from Monitor Agent
- Handle missing or incomplete data gracefully
๐ Statistical Analysis
- Calculate mean, median, and percentiles for resource usage
- Compute variance and standard deviation
- Identify usage distributions (normal, bimodal, etc.)
- Track trends over time (increasing/decreasing usage)
๐งฉ Pattern Recognition
- Group similar jobs using clustering algorithms
- Identify job families with consistent resource patterns
- Detect periodic behaviors (daily, weekly cycles)
- Find correlations between job parameters and usage
๐ฎ Predictive Modeling
- Predict expected resource needs for new job submissions
- Estimate job runtime based on historical patterns
- Provide confidence intervals for predictions
- Update models incrementally as new data arrives
Profile Generation Process
90 days] --> B[Data Cleaning
Remove Outliers] B --> C[Feature Extraction
CPU, GPU, Memory, Time] C --> D[Statistical Analysis
Mean, P50, P95, P99] D --> E{Job Pattern
Recognized?} E -->|Yes| F[Assign to
Job Family] E -->|No| G[Create New
Profile] F --> H[Update Family
Statistics] G --> H H --> I[Store in
Profile DB] I --> J[Cache Hot
Profiles in Redis] J --> K[Available for
Planner Queries] style B fill:#fc8d62 style D fill:#fc8d62 style E fill:#8da0cb style H fill:#fc8d62
Implementation Details
Technology Stack
- Language: Python 3.11+
- Data Processing: Pandas, NumPy
- ML: scikit-learn for clustering
- Caching: Redis with TTL
- Database: SQLAlchemy + PostgreSQL
Profile Types
- Per-Job: Individual job history
- Per-User: User's typical usage patterns
- Per-Workload: ML, simulation, data processing
- Per-Group: Research group aggregates
Planner Agent
Intelligent Decision Making
Overview
The Planner Agent is the brain of ASRO, using AI and machine learning to generate ranked optimization recommendations. It combines current metrics, historical profiles, and domain knowledge to propose safe and effective resource optimizations.
Internal Architecture
GPT-4/Claude] ActionGen[Action Generator] Simulator[Action Simulator] RiskAssess[Risk Assessor] Ranker[Recommendation Ranker] end subgraph "Input Sources" Anomalies[Monitor Anomalies] Profiles[Profiler Data] Policies[Policy Rules] end subgraph "Tools via MCP" JobSim[Job Simulator] SlurmAPI[Slurm Query Tools] TopoQuery[Topology Tools] end subgraph "Output" Kafka[Kafka:
Recommendations] Audit[Audit Agent] end Anomalies --> EventProc EventProc --> ContextBuilder Profiles --> ContextBuilder Policies --> ContextBuilder ContextBuilder -->|Prompt| LLM LLM -->|Candidate Actions| ActionGen ActionGen -->|Simulate| Simulator Simulator <-->|MCP Call| JobSim Simulator <-->|MCP Call| SlurmAPI Simulator -->|Predicted Impact| RiskAssess Policies --> RiskAssess RiskAssess -->|Scored Actions| Ranker Ranker -->|Publish| Kafka Ranker -->|Submit| Audit style LLM fill:#8da0cb,stroke:#6b7fa8,stroke-width:3px style ActionGen fill:#8da0cb style Simulator fill:#ffd92f style RiskAssess fill:#fc8d62 style Ranker fill:#8da0cb
Key Responsibilities
๐ง Recommendation Generation
- Receive anomaly events and query relevant profiles
- Use LLM to reason about potential optimizations
- Generate multiple candidate actions (rebind GPU, resize, change QoS)
- Consider job-specific constraints and requirements
๐ฏ Action Simulation
- Invoke Job Simulator with proposed changes
- Predict impact on queue time, utilization, throughput
- Estimate success probability using historical data
- Calculate expected resource savings
โ๏ธ Risk Assessment
- Score each action based on potential disruption
- Consider job criticality and user priority
- Factor in confidence level of predictions
- Apply policy constraints (e.g., no changes during peak hours)
๐ Ranking and Submission
- Rank recommendations by expected benefit vs. risk
- Generate natural language explanations
- Submit to Audit Agent for approval workflow
- Track feedback on recommendation outcomes
LLM Integration
Implementation Details
Technology Stack
- Language: Python 3.11+
- LLM Framework: LangChain
- Models: GPT-4, Claude 3.5 Sonnet
- Tool Access: Model Context Protocol
- Simulation: Custom discrete-event simulator
Optimization Types
- GPU Binding: Fix CUDA_VISIBLE_DEVICES
- Right-sizing: Adjust CPU/GPU/memory requests
- QoS Tuning: Modify scheduling priority
- Backfill: Promote short jobs to gaps
Executor Agent
Safe Implementation
Overview
The Executor Agent safely applies approved optimization actions to the Slurm cluster. It implements multi-stage safety mechanisms including dry-run, canary deployment, and automatic rollback to ensure changes don't harm running workloads.
Internal Architecture
10% subset] FullDeploy[Full Deployment] Monitor[Post-execution Monitor] Rollback[Rollback Controller] end subgraph "External Systems" Slurm[Slurm Controllers
scontrol/slurmrestd] MCP[MCP Gateway] end subgraph "Monitoring" MetricMon[Monitor Agent] end subgraph "Logging" AuditDB[Audit Database] end Receiver -->|Approved Action| Validator Validator -->|Valid?| DryRun DryRun -->|Log Expected Changes| AuditDB DryRun --> Checkpoint Checkpoint -->|Save State| Canary Canary <-->|MCP Call| MCP MCP <-->|Execute| Slurm Canary -->|Request Monitoring| MetricMon MetricMon -->|Canary Metrics| Monitor Monitor -->|Success?| FullDeploy Monitor -->|Failure| Rollback FullDeploy <-->|MCP Call| MCP FullDeploy -->|Log Success| AuditDB Rollback -->|Restore State| Slurm Rollback -->|Log Rollback| AuditDB style DryRun fill:#e78ac3 style Canary fill:#ffd92f style Monitor fill:#fc8d62 style Rollback fill:#d9534f style FullDeploy fill:#5cb85c
Key Responsibilities
โ Pre-execution Validation
- Verify action has required approvals
- Check cluster state hasn't changed since recommendation
- Validate Slurm API accessibility
- Confirm target jobs/nodes still exist
๐งช Dry-run Execution
- Simulate action without making actual changes
- Log all commands that would be executed
- Verify no syntax or permission errors
- Provide detailed execution plan
๐ Canary Deployment
- Apply change to 10% subset of affected jobs
- Monitor canary metrics for 15 minutes
- Compare against baseline performance
- Proceed or abort based on results
โฉ๏ธ Automatic Rollback
- Detect performance degradation post-execution
- Restore previous state from checkpoint
- Requeue affected jobs if necessary
- Notify stakeholders of rollback
Execution Flow
Action] --> B{Dry-run
Mode?} B -->|Yes| C[Execute Dry-run] C --> D[Log Expected Changes] D --> E[Return Report] B -->|No| F[Create Checkpoint] F --> G{Risk Level} G -->|High| H[Canary Deployment
10% subset] G -->|Low/Medium| M[Full Deployment] H --> I[Monitor 15 min] I --> J{Metrics OK?} J -->|Yes| M J -->|No| K[Automatic Rollback] M --> N[Monitor 30 min] N --> O{Metrics OK?} O -->|Yes| P[Mark Success
Keep Changes] O -->|No| K K --> Q[Restore Checkpoint] Q --> R[Log Rollback
Notify Stakeholders] style C fill:#e78ac3 style H fill:#ffd92f style M fill:#5cb85c style K fill:#d9534f style P fill:#5cb85c
Implementation Details
Technology Stack
- Language: Python 3.11+
- Slurm API: pyslurm + REST client
- State Management: JSON checkpoints
- Tool Access: Model Context Protocol
- Monitoring: Real-time metric streaming
Safety Mechanisms
- Checkpoints: Full state saved before changes
- Canary %: 10% by default, configurable
- Monitor Window: 15-30 min observation
- Rollback Time: < 60 seconds average
Audit Agent
Transparency and Accountability
Overview
The Audit Agent manages approval workflows, maintains immutable audit logs, and provides transparency to administrators. It enforces policy constraints and ensures all system actions are traceable and explainable.
Internal Architecture
Risk Thresholds] ApprovalManager[Approval Manager] Notifier[Notification Service] LogWriter[Immutable Log Writer] Reporter[Report Generator] end subgraph "Storage" AuditDB[(Audit Database
PostgreSQL
Append-Only)] Checksums[Cryptographic
Checksums] end subgraph "User Interfaces" Dashboard[Web Dashboard] Email[Email Service] Slack[Slack/Teams] end subgraph "Input" Planner[Planner
Recommendations] Executor[Executor
Action Results] AllAgents[All Agents
Events] end Planner --> Receiver Receiver --> PolicyEngine PolicyEngine -->|High Risk| ApprovalManager PolicyEngine -->|Low Risk| LogWriter ApprovalManager --> Dashboard ApprovalManager --> Notifier Notifier --> Email Notifier --> Slack Dashboard -->|Approval Decision| ApprovalManager ApprovalManager -->|Approved| LogWriter Executor --> LogWriter AllAgents --> LogWriter LogWriter --> AuditDB LogWriter --> Checksums AuditDB --> Reporter Reporter --> Dashboard style PolicyEngine fill:#a6d854 style ApprovalManager fill:#ffd92f style LogWriter fill:#a6d854,stroke:#7fb83d,stroke-width:3px style AuditDB fill:#e8f4f8 style Checksums fill:#fc8d62
Key Responsibilities
๐ Approval Workflow
- Evaluate recommendations against risk thresholds
- Route high-risk actions for human approval
- Auto-approve low-risk routine optimizations
- Track approval decisions and response times
๐ข Stakeholder Notification
- Notify job owners when their jobs are optimized
- Alert administrators of pending high-risk actions
- Send summaries of daily optimization activity
- Escalate issues requiring immediate attention
๐ Immutable Logging
- Record all events in append-only database
- Compute cryptographic checksums for integrity
- Capture full context: who, what, when, why
- Store both successful and failed actions
๐ Reporting and Analytics
- Generate daily/weekly optimization reports
- Calculate ROI metrics (time saved, resources freed)
- Identify trends in optimization types
- Provide audit trails for compliance
Approval Workflow
from Planner] --> B[Policy Engine] B --> C{Risk Score} C -->|Low: 0-3| D[Auto-approve] C -->|Medium: 4-6| E[Require 1
Admin Approval] C -->|High: 7-10| F[Require 2
Admin Approvals] D --> G[Log Decision] E --> H[Notify Admin
via Dashboard] H --> I{Approved?} I -->|Yes| G I -->|No| J[Log Rejection
Notify Planner] F --> K[Notify Senior
Admins] K --> L{Both Approved?} L -->|Yes| G L -->|No| J G --> M[Forward to
Executor] J --> N[Archive
Rejected Action] style B fill:#a6d854 style C fill:#ffd92f style D fill:#5cb85c style E fill:#f0ad4e style F fill:#fc8d62 style G fill:#a6d854
Implementation Details
Technology Stack
- Language: Python 3.11+
- Database: PostgreSQL with append-only tables
- Integrity: SHA-256 checksums
- Notifications: SendGrid, Slack SDK
- Dashboard: WebSocket for real-time updates
Audit Log Schema
- Event ID: Unique identifier
- Timestamp: Nanosecond precision
- Actor: Agent or human user
- Action: What was done or proposed
- Context: Full state and reasoning
- Outcome: Success, failure, or rollback
- Checksum: Integrity verification
Agent Comparison Matrix
| Agent | Primary Function | Key Technology | Scalability | Criticality |
|---|---|---|---|---|
| Monitor | Real-time metric collection and anomaly detection | Prometheus, nvidia-smi, Kafka | 10,000+ nodes | ๐ด High - System eyes |
| Profiler | Historical analysis and pattern recognition | Pandas, scikit-learn, PostgreSQL | Millions of jobs | ๐ก Medium - Informs decisions |
| Planner | AI-powered recommendation generation | LangChain, GPT-4, MCP | 100 concurrent recommendations | ๐ด High - Decision maker |
| Executor | Safe action implementation with rollback | Slurm API, MCP, Checkpoints | 1000 jobs/hour | ๐ด Critical - Touches production |
| Audit | Approval workflow and immutable logging | PostgreSQL, WebSocket, Email | 10,000 events/min | ๐ด High - Compliance |
Inter-Agent Communication
Agent] -->|Anomaly Events| K[Kafka] P[Profiler
Agent] -->|Profile Updates| K K -->|Subscribe| PL[Planner
Agent] K -->|Subscribe| M K -->|Subscribe| A[Audit
Agent] PL <-->|gRPC Query:
Get Profile| P PL -->|Recommendation| A A -->|Approved Action| E[Executor
Agent] E -->|Request Metrics| M E -->|Log Result| A M -.->|Real-time Stream| Dashboard[Web
Dashboard] A -.->|Approval UI| Dashboard style M fill:#66c2a5 style P fill:#fc8d62 style PL fill:#8da0cb style E fill:#e78ac3 style A fill:#a6d854 style K fill:#ffd92f
Solid arrows: Asynchronous event-driven (Kafka)
Double arrows: Synchronous RPC (gRPC)
Dashed arrows: WebSocket streaming (Dashboard)