AegisFlow
Autonomous cluster telemetry and Bayesian HMM scheduler that cuts deadline misses by 87%
Bayesian HMM • 99.58% State Accuracy • Zero Dependencies
Description
Zero-dependency Python distributed cluster scheduler designed for latent node degradation and sudden crashes. An exact Bayesian Hidden Markov Model infers hidden node health in 0.13–0.35 steps with 99.58% accuracy, while mathematical triage gating and a cold-restart expected-value barrier hold unnecessary migrations at 0.00 and capture 96% of the Oracle ceiling.
Timeline
98.3%
Role
AI Systems Engineer
Status
Production
Year
2026
Deployment
0.64 ms/step Engine
Core Stack
Pure Python / Bayesian HMM
Why I Built It
Understanding the core problems, proposed solutions, and realized product achievements.
When cluster nodes silently degrade or crash mid-workload, naive round-robin and greedy schedulers keep dispatching tasks into dead queues—causing cascading deadline misses and wasteful cold-restart thrashing.
Node 2 enters silent degradation (elevated latency_ms and error_rate, heartbeat_ok still noisy).
Exact HMM forward filter updates posterior belief over {Healthy, Degraded, Down} and detects degradation in 0.13 steps.
Task progress stalls; HMM confirms node is Down with 99.58% state accuracy and 0.000% false condemnations.
Triage gate drops doomed tasks (-0.01/step pending vs -1.00 miss penalty) while EV barrier blocks useless migrations (0.00 churn).
Deadline misses drop 87% (98.2 -> 13.2) and on-time completion climbs to 98.3% at 0.64 ms/step.
Replace heuristic z-scores with an Exact Bayesian HMM filter
agent.pyForward-filters emission likelihoods across heartbeat_ok, latency_ms, error_rate, and per-task duration_remaining while discarding zero-signal queue_len.
Enforce hard capacity and mathematical triage gating
agent.pyComputes analytical completion probability before allocating a slot; leaving a doomed task pending costs ~100x less than letting it poison a healthy slot (+714 pt ablation swing).
Guard reroutes with a Cold-Restart Expected-Value Barrier
agent.pyBecause rerouting resets elapsed progress to zero, tasks only migrate when target completion gain exceeds the restart penalty — yielding exact 0.00 unnecessary migrations.
Verify 31 strict behavioral invariants and crash containment
test_invariants.pyDual try/except safety wrapper falls back in <0.1ms to capacity-respecting actions (+338.0 reward even under injected internal faults).
Captures 96% of the theoretical Oracle ceiling (745.00 vs 750.94 pts) with 100% head-to-head seed wins against baseline on held-out perturbed clusters.
- Deadline miss drop
- -87%
- On-time completion
- 98.3%
- Oracle ceiling captured
- 96%
- Decision speed
- 0.64 ms/step
Architecture Pipelines
Visual system flow diagrams representing data pipelines and structured checks.
Exact Bayesian HMM
Tracks 3-state hidden Markov posterior per node from noisy latency, heartbeat, error rate, and task progress.
Analytical Triage Gate
Slack-ordered urgency planner that suppresses mathematically uncompletable tasks rather than starving viable jobs.
Cold-Restart EV Barrier
Weighs lost progress against target node survival probability to eliminate thrashing (0.00 spurious churn).
Recovery Probation Ramp
Throttles initial capacity on recovering nodes so flaky Markov transitions don't cause stampeding herds.
31 Invariants & Fallback
Zero-dependency stdlib implementation with <0.1ms exception fallback and full ablation benchmark harness.
Features & Capabilities
Key features and built-in components implemented inside the codebase.
- ✓Exact Bayesian Hidden Markov Model forward filter (0.13s degraded detection, 0.35s down detection, 99.58% accuracy)
- ✓87% reduction in deadline misses (98.2 -> 13.2) and 98.3% on-time rate across paired 400-step benchmarks
- ✓Cold-restart expected-value barrier guaranteeing 0.00 unnecessary task migrations
- ✓Defensive probation ramp dampening post-recovery Markov oscillations
- ✓Zero external dependencies (pure Python stdlib) executing at 0.64 ms/step (39x faster than 25.0 ms budget)
- ✓31/31 deterministic system invariant tests passing + 100% win rate across held-out perturbed Markov chains
Solving Complex Bottlenecks
A deep dive into security rule architectures, race conditions, and verification solutions.
Early blueprint heuristics treated high queue_len as node distress evidence alongside latency and error rates.
In the real cluster simulator, queue_len simply mirrors the scheduler's own past dispatches with zero noise or health dependence—feeding it into inference caused circular self-reinforcing bias.
Audit true emission distributions per hidden state in cluster_env.py
env/cluster_env.pyDrop queue_len from Bayesian likelihood updates entirely
agent.pyUse task stall progress (duration_remaining delta) as direct state evidence
agent.py"Feature intuition has to bow to the real generative model—feeding a deterministic echo of your own actions into a Bayesian filter creates confirmation bias."
Development Journey
A chronological day-by-day log detailing core milestones and features added.
Emission Audit & Exact HMM Filter
Replaced initial CUSUM draft with an exact 3-state HMM forward filter once true emission profiles and pre-step act() order were verified.
Triage Gating & Cold-Restart Barrier
Added hard-capacity enforcement, slack urgency ordering, and EV migration barrier—capturing 96% of the Oracle ceiling.
Ablations, 31 Invariants & Scale Verification
Ran held-out perturbed Markov generalization benchmarks, verified 31/31 invariants, and scaled to 32 nodes / 256 slots at 4.42 ms/step.
Operational Metrics
No public-facing site to audit — these are the safeguards that keep an unattended pipeline honest.
infers node degradation in 0.13 steps and crashes in 0.35 steps with 0.000% false condemnations
cold-restart expected-value barrier eliminates thrashing across all paired benchmark seeds
capacity limits, crash containment, and monotonicity properties verified in test_invariants.py
0.64 ms/step measured vs 25.0 ms wall-clock budget (4.42 ms/step at 32 nodes / 256 slots)
Trade-off Explanations
Concise rationales for technology selections and future roadmaps.
Analytical Posterior Over Black-Box RL
Exact 3-State HMMWith known emission noise characteristics and a 400-step episode budget, exact forward filtering converges in sub-millisecond time without training instability or opaque failure modes.
Zero External Dependencies for 0.64ms Latency
Pure Python StdlibAvoiding NumPy/PyTorch array dispatch overhead keeps per-step scheduling under 1ms on small clusters and guarantees deterministic portability in any sandbox.
Refusing Doomed Work Beats Best-Effort Queuing
Triage SuppressionScoring +1 completion vs -1 miss vs -0.01/step pending makes leaving an uncompletable task unassigned ~100x cheaper than burning a healthy slot on it.
"Evaluating scaling adjustments and cache controls shows true engineering maturity."
- ✓Add online Baum-Welch / Dirichlet transition adaptation so the HMM self-calibrates if cluster failure rates shift mid-episode beyond fixed priors.
- ✓Extend task urgency planning with batch-aware bin packing when heterogeneous task durations arrive in synchronized bursts.
- ✓Export real-time Prometheus/OpenTelemetry metrics from the decision log stream for live cluster operator visibility.
Finished exploring this session?
End the workspace session to release resources and return back to the primary portfolio index.