AI Engineer Portal
Your personal operating system for career transition.
Exercise
Build a production quality alert system
Build a Production Quality Alert System
Quality alerts should trigger on patterns, not individual events. A single bad response is noise. A 10% decline in pass rate over 4 hours is a signal worth waking someone up for.
What to build
Implement QualityAlertSystem:
-
record_event(feature, score, passed, timestamp_s=None)— Appends a quality event. Usestime.time()if timestamp not provided. -
rolling_stats(feature, window_seconds=3600) -> dict— Computes stats for the most recentwindow_seconds:{"n", "pass_rate", "avg_score", "p5_score", "p95_score"}. Returns empty dict if no events. -
check_alerts(feature, thresholds: dict | None = None) -> list[dict]—thresholdssupports:min_pass_rate(default 0.8),min_avg_score(default 0.7),max_p5_score_floor(default 0.3, alert if p5 drops below this). Returns list of{"alert_type", "current_value", "threshold", "feature"}dicts. -
baseline_drift(feature, baseline_pass_rate: float) -> dict | None— Returns{"delta", "is_drift": bool}whereis_driftis True when rolling pass rate is more than 0.05 below baseline. Returns None if fewer than 20 events in window.
Constraints
- Standard library only. Window eviction uses event timestamps, not wall-clock time.
Evaluation / hard / Step 32 of 36
Evaluation and review loops
Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.
- - Produces a useful signal, not decorative output
- - Makes regression review easier
- - Would support a benchmark or observability loop
- - Would this output help decide what to fix next?
- - Are important failure modes visible?
- - Does the score hide any ambiguity I should record?
Practice
Generate a variation
Generate a new exercise variation to deepen understanding or practice a related concept.
Attempt history
Recent submissions
Before you submit, decide what a strong answer should make obvious to the reviewer.
No attempts yet.