Introduction
This document explains the reasoning behind major design decisions in ASRO. Each decision addresses specific requirements and constraints while balancing competing concerns such as safety, performance, maintainability, and usability. We present our decisions in priority order based on their impact on system quality.
Multi-Agent Architecture with Specialized Roles
Requirements Addressed
FR-1, FR-4, FR-5, FR-13, NFR-4, NFR-5, NFR-13
Decision
We chose to implement ASRO as five specialized agents (Monitor, Profiler, Planner, Executor, Audit) rather than a monolithic service or a simpler two-component design.
Rationale
Separation of Concerns: Each agent has a clear, focused responsibility. This makes the system easier to understand, test, and modify. For example, changes to monitoring logic do not affect execution logic.
Fault Isolation: If the Planner agent fails, the Monitor can continue collecting data and the system can recover gracefully. This addresses NFR-5 by preventing cascading failures.
Independent Scaling: Monitoring is a continuous, high-throughput activity, while planning is computationally intensive but episodic. Separate agents allow us to scale each component independently based on its workload.
Maintainability: Teams can work on different agents concurrently without conflicts. We can also replace or upgrade individual agents without redeploying the entire system, satisfying NFR-13.
Alternatives Considered
Monolithic Service: A single application handling all responsibilities would be simpler to deploy but would create tight coupling, make testing difficult, and prevent independent scaling. Failure of any component would bring down the entire system.
Microservices without Agent Framework: Standard microservices could provide similar modularity, but the agent paradigm better captures the autonomous, decision-making nature of components like Planner and gives us access to LLM-based reasoning capabilities.
Trade-offs
Increased Complexity: Multiple agents require coordination logic, inter-agent communication, and distributed debugging. However, we accept this complexity to gain reliability and maintainability.
Latency: Communication between agents adds overhead compared to in-process calls. We mitigate this by using fast event streaming and low-latency gRPC where synchronous responses are needed.
Dual Communication Channels: Event Backbone and RPC
Requirements Addressed
NFR-1, NFR-2, NFR-5, NFR-6, NFR-9
Decision
We use Apache Kafka for asynchronous event-driven communication and gRPC with mutual TLS for synchronous request-response interactions.
Rationale
Event-Driven for Durability: Kafka provides durable, ordered event streams. If an agent is temporarily down, it can replay events when it recovers. This supports NFR-6 by ensuring no data is lost and NFR-5 by enabling fault tolerance.
Decoupling: Agents publish events without knowing which other agents will consume them. This loose coupling allows us to add new agents or change event handling logic without modifying producers.
RPC for Interactive Operations: Some operations require immediate responses. For example, the web dashboard needs real-time data, and the Planner may need to query the Profiler synchronously. gRPC provides low-latency communication suitable for these cases, addressing NFR-11.
Security: gRPC with mutual TLS ensures all synchronous communications are authenticated and encrypted, satisfying NFR-7 and NFR-9.
Alternatives Considered
Kafka Only: Using only Kafka would require request-response patterns through temporary reply topics, adding complexity and latency to interactive queries.
REST APIs Only: REST could handle synchronous calls but lacks strong typing, efficient serialization, and native streaming support. REST also typically does not enforce mutual TLS as strictly as gRPC frameworks.
Message Queue (RabbitMQ): RabbitMQ could replace Kafka but offers weaker durability guarantees and lower throughput for our high-volume monitoring events.
Trade-offs
Operational Complexity: Running both Kafka and gRPC infrastructure increases deployment and monitoring overhead. We accept this because the combination provides the best fit for our mixed workload.
Model Context Protocol for Tool Integration
Requirements Addressed
FR-20, NFR-7, NFR-8, NFR-14
Decision
We integrate external tools and system commands through the Model Context Protocol rather than allowing agents direct system access.
Rationale
Safety and Control: MCP acts as a controlled gateway. The Planner and Executor agents, which may use LLM-based decision-making, cannot execute arbitrary commands. Only whitelisted tools are exposed, preventing accidental or malicious actions.
Auditability: Every tool invocation passes through MCP, where it is logged with parameters and results. This complete audit trail addresses NFR-8 and supports post-mortem analysis.
Testability: We can mock the MCP interface during testing to simulate tool responses without requiring actual cluster access. This improves maintainability as per NFR-14.
Centralized Policy Enforcement: Access control policies and rate limits can be enforced in one place rather than being scattered across agents.
Alternatives Considered
Direct System Access: Allowing agents to run commands directly would be simpler but extremely risky. An error in planning logic could execute destructive operations. This was unacceptable given FR-20's emphasis on safe integration.
Custom Tool Wrapper: We could build our own tool abstraction layer, but MCP is an emerging standard designed specifically for LLM-tool interactions and provides battle-tested safety mechanisms.
Trade-offs
Additional Layer: MCP adds an extra hop between agents and tools, increasing latency slightly. However, the safety and auditability benefits far outweigh this minor performance cost.
Multi-Stage Safety Mechanism: Simulation, Approval, Canary, Rollback
Requirements Addressed
FR-6, FR-7, FR-9, FR-10, FR-11, FR-12, FR-17, NFR-10
Decision
We implement a four-stage safety process: simulate the change, require human approval for high-risk actions, apply changes to a canary subset first, and automatically rollback if metrics worsen.
Rationale
Defense in Depth: Multiple independent safeguards reduce the risk of harmful actions reaching production. Even if one stage fails to catch a problem, subsequent stages can prevent or mitigate damage.
Confidence Building: Simulation (FR-6) lets us predict outcomes before execution. Canary deployments (FR-11) validate predictions in the real environment with limited blast radius. This staged approach addresses the inherent uncertainty in LLM-based planning.
Human Oversight Where Needed: Not all changes require approval, which would create bottlenecks. We use risk scoring (FR-7) to determine when human judgment is necessary, satisfying FR-10 while maintaining automation for low-risk changes.
Fast Recovery: Automatic rollback (FR-12) minimizes the impact of incorrect decisions. Users experience brief degradation rather than sustained outages.
Transparency: Each stage is logged in detail (FR-17), providing administrators with complete visibility into what happened and why, which supports NFR-10's usability goal.
Alternatives Considered
Always Require Approval: Requiring human approval for every action would eliminate automation benefits and violate the project goal of "minimal human work."
No Simulation: Skipping simulation would speed up execution but increase the risk of unexpected outcomes, especially given the complexity of HPC scheduling.
No Automatic Rollback: Manual rollback would be slower and could leave the cluster in a degraded state longer, harming user experience and violating NFR-4's availability requirement.
Trade-offs
Increased Latency: The full safety pipeline adds time between problem detection and resolution. However, correctness and safety are more important than speed for infrastructure changes.
Complexity: Implementing simulation and rollback logic is nontrivial. We accept this complexity as essential for building operator trust.
Separate Data Stores for Different Data Types
Requirements Addressed
FR-1, FR-4, FR-17, NFR-1, NFR-2, NFR-6, NFR-8
Decision
We use three distinct data stores: a time-series database (Prometheus/VictoriaMetrics) for metrics, a relational database (PostgreSQL) for audit logs, and a hybrid cache (Redis) plus relational store for profiles.
Rationale
Optimized for Access Patterns: Time-series data requires efficient range queries and compression, which Prometheus provides. Audit logs need strong consistency and append-only semantics, which PostgreSQL handles well. Profiles need fast lookups with occasional batch updates, making Redis plus PostgreSQL ideal.
Performance: Specialized databases outperform general-purpose solutions for their target workloads. This helps us meet NFR-1's latency requirement and NFR-2's scalability goal.
Data Integrity: PostgreSQL's ACID properties ensure audit logs (FR-17) are never corrupted or lost, addressing NFR-6 and NFR-8.
Independent Scaling: We can scale the time-series database independently from the audit database based on their different growth rates and query patterns.
Alternatives Considered
Single Relational Database: Storing everything in PostgreSQL would simplify deployment but would not perform well for high-cardinality time-series queries at scale.
NoSQL for Everything: A document database like MongoDB could store all data types but would lack the specialized query capabilities and integrity guarantees we need.
Trade-offs
Operational Overhead: Managing three database technologies requires more expertise and infrastructure. However, the performance and reliability benefits justify this cost for a production system.
LLM-Based Planning with Structured Reasoning
Requirements Addressed
FR-5, FR-8, NFR-10
Decision
The Planner agent uses a large language model to generate optimization recommendations, combining historical data, current metrics, and domain knowledge.
Rationale
Handling Complexity: HPC resource optimization involves many interacting factors that are difficult to encode in rules. LLMs can reason about complex scenarios and identify non-obvious patterns, enabling FR-5's sophisticated recommendations.
Adaptability: New types of optimization opportunities can be addressed by updating prompts and examples rather than rewriting code. This makes the system more maintainable and extensible.
Natural Language Explanations: LLMs can generate clear explanations of their reasoning, directly supporting NFR-10's requirement for understandable recommendations.
Batch Optimization: LLMs excel at identifying patterns across multiple similar cases, enabling FR-8's batch optimization capability.
Alternatives Considered
Rule-Based System: Hardcoded rules would be more predictable but would require extensive tuning and would miss complex interactions. Rules are also difficult to explain to users.
Classical Machine Learning: ML models could detect patterns but would not provide natural language explanations and would require large labeled datasets that we do not have.
Trade-offs
Non-Determinism: LLM outputs can vary between runs, which is why we require simulation and validation stages. However, the safety mechanisms in DD-4 mitigate this risk.
Computational Cost: LLM inference is expensive. We mitigate this by caching common scenarios and only invoking the LLM for novel situations.
Centralized Audit Agent with Immutable Logging
Requirements Addressed
FR-10, FR-17, NFR-8, NFR-10
Decision
All approval workflows and audit logging are handled by a dedicated Audit agent that stores records in an append-only database with cryptographic checksums.
Rationale
Single Source of Truth: Centralizing audit logic ensures consistent logging across all agents and prevents fragmented or contradictory records.
Tamper Evidence: Append-only storage with checksums (NFR-8) makes any attempt to modify logs detectable, providing strong accountability for compliance and forensics.
Clear Approval Workflow: The Audit agent enforces policy consistently (FR-10) without requiring each agent to implement approval logic.
Reporting: Centralizing audit data makes it easy to generate comprehensive reports and dashboards showing system activity over time.
Alternatives Considered
Distributed Logging: Each agent could maintain its own logs. However, this would make correlation difficult and increase the risk of inconsistencies or gaps.
External Audit Service: We could use a third-party audit platform, but this would introduce external dependencies and potential privacy concerns for cluster data.
Trade-offs
Single Point of Bottleneck: The Audit agent handles all logging, which could become a bottleneck. We address this through efficient async writes and batching.
Containerized Deployment with Kubernetes
Requirements Addressed
NFR-2, NFR-4, NFR-5, NFR-13
Decision
All ASRO components are packaged as Docker containers and deployed using Kubernetes for orchestration.
Rationale
Scalability: Kubernetes can automatically scale agents based on workload, helping meet NFR-2's requirement to handle large clusters.
High Availability: Kubernetes can automatically restart failed containers and redistribute work, supporting NFR-4 and NFR-5.
Simplified Deployment: Containers package all dependencies, making deployment consistent across environments. This reduces the setup time mentioned in NFR-12.
Rolling Updates: Kubernetes supports zero-downtime updates by gradually replacing old containers with new versions, enabling NFR-13's independent component updates.
Industry Standard: Kubernetes is widely adopted, so administrators are likely to be familiar with it, reducing operational burden.
Alternatives Considered
Virtual Machines: VMs provide stronger isolation but are heavier and slower to start than containers. For agent workloads, containers offer sufficient isolation with better resource efficiency.
Bare Metal Deployment: Deploying directly on physical servers would eliminate container overhead but would make scaling and updates much more difficult.
Simpler Orchestration (Docker Compose): Docker Compose is easier to configure but lacks Kubernetes' sophisticated scheduling, health checking, and scaling capabilities needed for production.
Trade-offs
Kubernetes Complexity: Kubernetes has a steep learning curve. However, this investment pays off through operational benefits at scale.
Web-Based Dashboard with Real-Time Updates
Requirements Addressed
FR-16, NFR-11, NFR-10
Decision
We provide a React-based single-page application that connects via WebSocket for real-time updates rather than requiring periodic page refreshes.
Rationale
Responsive Interface: React's virtual DOM provides fast UI updates, helping meet NFR-11's 2-second response time requirement.
Real-Time Visibility: WebSocket connections push updates to the dashboard immediately, so administrators see pending approvals and completed actions without delay.
Modern User Experience: A well-designed web interface lowers the barrier to using ASRO, supporting NFR-10's usability goal.
No Installation Required: Unlike desktop applications, the web dashboard requires no client-side installation, simplifying deployment.
Alternatives Considered
Command-Line Interface: A CLI would be lighter weight but would not provide the rich visualizations and interactive approval workflows that administrators need.
Polling-Based Updates: HTTP polling would be simpler than WebSockets but would increase latency and server load.
Trade-offs
Development Effort: Building a quality web interface requires significant frontend development. However, this investment improves adoption and operational efficiency.
Dry-Run Mode for All Actions
Requirements Addressed
FR-9, NFR-12
Decision
The Executor agent supports a dry-run mode where it logs all actions it would take without actually modifying cluster state.
Rationale
Safe Testing: Administrators can validate ASRO's behavior in production environments without risk, which is essential during initial deployment (NFR-12).
Debugging: Dry-run mode helps diagnose issues in action generation and execution logic.
Confidence Building: Operators can observe what ASRO would do before enabling automatic execution, reducing deployment anxiety.
Compliance: Some organizations require approval workflows to include a "what-if" analysis, which dry-run mode provides.
Alternatives Considered
Simulation Only: The simulator provides predictions but does not exercise actual execution paths. Dry-run mode complements simulation by testing the real code paths.
Trade-offs
Implementation Complexity: All execution code must distinguish between dry-run and real execution. This requires careful design but is worthwhile for the safety benefits.
Summary
ASRO's design reflects careful balancing of competing concerns. We prioritize safety and transparency because operators must trust the system with critical infrastructure. We choose proven technologies like Kafka and Kubernetes to reduce operational risk. We accept increased complexity where it provides clear benefits in reliability, scalability, or maintainability.
The multi-stage safety process (DD-4) and Model Context Protocol integration (DD-3) are particularly critical for earning operator trust. The multi-agent architecture (DD-1) and dual communication channels (DD-2) provide the foundation for a scalable, resilient system that can grow with cluster size.
Each decision is grounded in specific requirements and evaluated against realistic alternatives. Where we introduce complexity, we do so deliberately and with clear rationale.