--- license: apache-2.0 pretty_name: "3amBench (AlertForge)" language: [en] task_categories: [other] size_categories: [n<1K] tags: [harbor, openenv, rl-environment, agent, benchmark, dense-reward, prometheus, alertmanager, promql, sre, slo, observability] configs: - config_name: default data_files: manifest.jsonl --- # 3amBench: can your agent write alerts that page the right human at 3 a.m., and only then? 3amBench (package `alertforge`) is an RL environment and benchmark for a job SRE teams do every week: owning **Prometheus alerting rules and Alertmanager routing as code**. Each task drops the agent into a realistic `monitoring/` repo for a fictional company with a handful of change requests: onboard a service onto multi-window burn-rate SLO alerts, fix the alert that paged 30 times last night, find out why nobody was paged when a service was down for 47 minutes, route a newly formed team, add inhibition so an outage produces one page instead of forty. **Grading is behavioral.** Nothing is judged by an LLM, and nothing is compared as text. Hidden, seed-varied outage replays run through Prometheus' own `promtool test rules`, and routing runs through Alertmanager's own `amtool`. Every alert must **fire** during the outage, stay **silent** during normal traffic, short spikes, recovery, low traffic and near-threshold traffic, fire **on time** (not before `for` elapses), fire **once per service** (not per pod), carry the right **labels**, and reach the right **receivers**. A task has 59-189 atomic checks, so the reward is dense. | | | |---|---| | Tasks | 30 (5 workflows × 3 tiers × 2 seeds), plus unlimited fresh ones from the generator / OpenEnv server | | Checks per task | 59-189 (easy 59-67, medium 112-139, hard 167-189) | | Reward | `reward` in [0, 1] plus 15 diagnostic keys, identical in every task | | Grader | promtool 3.5.0 + amtool 0.28.1 + stdlib Python + PyYAML; 0.7-7 s per grade, deterministic | | Formats | Harbor tasks (this repo) and an OpenEnv server with per-step reward (`openenv/alertforge_env`) | ## Quick start ```bash # oracle (expect mean 1.0) and no-op (expect 0.0) uvx harbor run --repo https://huggingface.co/datasets/openenvforge/3ambench@v0.1.0 -d 3ambench@0.1.0 -a oracle -n 4 uvx harbor run --repo https://huggingface.co/datasets/openenvforge/3ambench@v0.1.0 -d 3ambench@0.1.0 -a nop -n 4 # your model on the 5-task smoke set uvx harbor run --repo https://huggingface.co/datasets/openenvforge/3ambench@v0.1.0 -d 3ambench-mini@0.1.0 -a terminus-2 -m ``` Tasks set `[agent] network_mode = "no-network"`, because this repo ships the solutions (see Anti-hacking). Harbor enforces that on Linux Docker hosts and sandboxed providers. **Docker Desktop on macOS cannot enforce it** (its VM kernel lacks `CONFIG_NFT_FIB_INET`), and Harbor refuses the task. For local smoke runs on a Mac, use `scripts/harbor_local.sh`, which runs a temp copy without the network override. Those runs are not leaderboard-safe. **OpenEnv (multi-turn, per-step reward):** ```python from alertforge_env.client import AlertForgeEnv with AlertForgeEnv(base_url="https://openenvforge-3ambench-env.hf.space").sync() as env: obs = env.reset(seed=7, split="train", workflow="missed-page-postmortem", tier="medium") obs = env.step({"tool": "read_file", "path": "README.md"}) obs = env.step({"tool": "write_file", "path": "rules/service-health.yml", "content": "..."}) print(obs.reward, obs.done) # parity mode: rewards sum to the Harbor reward ``` **Fresh tasks (training, private held-out sets):** `python generator/generate.py --master-seed `. ## Try it - **Replay runs in the browser:** [3amBench Replay](https://huggingface.co/spaces/openenvforge/3ambench-replay) steps through recorded runs (tool calls, file diffs, the reward curve, and which checks pass after each step). Its data comes from `scripts/record_reference_runs.py`, `scripts/record_agent_runs.sh` and `scripts/export_runs.py`; the page itself is in `space/`. - **Run the environment locally** and open the web interface at http://localhost:8000/web: ```bash docker run -p 8000:8000 -e ENABLE_WEB_INTERFACE=true ghcr.io/devesh-maheshwari/3ambench-env:0.1.0 ``` ## What a task looks like `af-001-slo-onboarding-easy-s1` (instruction excerpt; change requests are shuffled): > - **P1.** `HighErrorRatio` is misbehaving; see `postmortems/PM-4043.md`. Fix the rule, keeping its purpose. > - **I1.** While `ChatGwDown` is firing for a service, suppress `ChatGwErrorBudgetBurnFast`, `HighErrorRatio` for that same service only. > - **A1.** Add `ChatGwErrorBudgetBurnFast` for `chat-gw` (SLO 0.995): fire when both `slo:sli_error:ratio_rate1h` and `slo:sli_error:ratio_rate5m` exceed 14.4 × (1 − 0.995), `for: 2m`, ... > - **R1.** Team `payments` is now on call for `chat-gw`, but nothing routes to them yet. ... > - **C1.** Add SLI recording rules `slo:sli_error:ratio_rate5m`, `slo:sli_error:ratio_rate1h` for the `grpc` SLI family ... The postmortem describes a *symptom* ("pages at 4 a.m. when there are only a handful of requests"), never the fix. At the `practitioner`/`expert` levels, requirements are stated as outcomes ("page payments when chat-gw is burning its error budget fast") and the agent has to find names, windows, `for` values, labels and routing policy in the repo's `README.md`, like a new hire would. Workflows: `slo-onboarding`, `alert-storm-cleanup`, `missed-page-postmortem` (including total outages where series disappear, so only `absent()` can page), `latency-slo` (histogram SLIs), `team-reorg-migration`. Rules come as plain files or as Kubernetes `PrometheusRule` manifests. ## Reward Each requirement r gets a score q_r from its check families (`mean(∅) = 1`): ``` Alert (new or repair): q = E · dup · mean(Fire ∪ Timing) · mean(Silent) · (0.7 + 0.3·mean(Label ∪ Annotation)) (burn alerts: q = ½·q_integrated + ½·q_with_reference_SLI_records) Recording: q = dup · mean(Value ∪ Cardinality) Route: q = mean_positive Jaccard(expected, resolved receivers) · mean_negative [no forbidden receiver] Inhibit: q = mean(Suppressed) · mean(NotSuppressed) s_r = clip((q_r − q_r^pristine) / (1 − q_r^pristine), −0.25, 1) # pristine → 0, oracle → 1, regressions < 0 progress = max(0, (0.5 + 0.5·preservation) · Σ w_r s_r / Σ w_r) # weights: alert 3, repair 3, others 2 reward = 0.6 · [every s_r = 1 ∧ preservation = 1 ∧ syntax_ok ∧ ¬tamper] + 0.4 · progress ``` Why products: an always-firing rule fails every silent check, and a renamed or never-firing rule fails every fire check, so both score 0. A catch-all route passes positives and fails negatives. An inhibit-everything rule fails the not-suppressed cases. Partial work still counts: a wrong severity costs the label family only, a missing `continue` gives Jaccard ½, and a correct burn alert on top of broken SLI records keeps half its credit. | Key | Meaning | |---|---| | `reward` | primary scalar | | `solved` / `outcome` | 1 iff everything is fully correct (use for pass@k) | | `progress` | the dense part (plot this separately; `reward` has a gap between 0.4 and 0.6 by construction) | | `preservation` | untouched rules, receivers, routes and inhibitions still intact | | `req_alerts`, `req_repairs`, `req_recording`, `req_routing`, `req_inhibit` | per-category scores | | `fire_rate`, `silent_rate`, `label_rate`, `check_pass_rate` | raw diagnostic pass rates (non-zero for a no-op) | | `syntax_ok`, `tamper` | all files load / a forbidden construct was used (tamper zeroes the reward) | ## Reward spread (measured, v0.1.0) | Policy | reward | notes | |---|---|---| | oracle (`solution/solve.sh`) | **1.0** on 30/30 | Harbor `-a oracle`: 1.0 on `af-001` (easy), `af-017` (hard, PrometheusRule), `af-023` (hard, latency), `af-029` (hard, reorg) | | no-op (`-a nop`) | **0.0** on 30/30 | `preservation` = 1 | | partial (`partial//solve.sh`: half the requirements plus one plausible mistake) | 0.17-0.29 | Harbor = local grader exactly (`af-017` 0.21644, `af-011` 0.208481) | | P-mut: oracle + 1-3 agent-style mistakes (duplicate alert, missing `by`, missing `continue`, scratch file, YAML indent slip, wrong `for`), 120 episodes | mean 0.386, 0% at 0, 10% at 1, 94 distinct values | `progress` mean 0.81 | | OpenEnv per step (read → write oracle files one at a time with one YAML slip → submit), 30 tasks | 54% of steps and 97% of writes change the reward | Σ step rewards = Harbor reward exactly (parity mode) | Adversaries (all 30 tasks, local gate): always-fire, rename, catch-all route, inhibit-all → targeted `req_*` ≤ 0.05. `ALERTS` injection, input-series shadowing, group `interval` changes → `tamper`, reward 0. Receiver nulling, over-broad inhibition, band thresholds, per-pod alerts, `for`-only fixes, deleting untouched rules → `outcome` 0 and reward ≤ 0.4. Real-model baselines are **not published yet**; they need API spend (planned milestone M-H: leaderboard, failure gallery, dense-vs-outcome GRPO curve). ## How it was built: Skill2Env, but procedural This mirrors NVIDIA's [Skill2Env](https://github.com/NVlabs/Skill2Env) pipeline: `skill/prometheus-alerting/SKILL.md` → `workflows/workflows.yaml` (the "planner output", same keys) → sampled axes (archetype, verifier pattern, persona, tone, expertise, tier, rules format) → **a deterministic, seeded creator** instead of an LLM → acceptance gate (oracle = 1, nop = 0, partial band, 14 adversaries, a "missing `for` must fail Timing" mutant check, structural leak scan, determinism). Checks are derived from the world spec through a **reference evaluator** (`promsim.py`: Prometheus `rate` extrapolation, left-open windows, `histogram_quantile`, staleness, the `for` state machine, in exact fractions), never from the oracle's rule text. The gate proves the oracle against real promtool, which is the structural equivalent of Skill2Env's freeze boundary. ## Anti-hacking | Threat | Defense | |---|---| | Downloading this repo's solutions | `[agent] network_mode = "no-network"`; no seeds in `task.toml`; hidden checks live only in the verifier image; evaluate headline numbers on a private-seed build | | Editing the grader or pre-writing rewards | separate verifier container built from `tests/Dockerfile`; `test.sh` deletes old outputs and verifies `checksums.sha256` | | Always-fire / never-fire / rename | fire × silent product; existence gate | | Per-pod alerts, threshold bands, `for`-only fixes | `count(ALERTS{...}) == 1` per service, bracketing scenarios at 0.85T/1.15T, random spikes, long spikes that must fire | | Faking `ALERTS`, shadowing input series, eval knobs | tamper: reserved record names, `label_replace` onto reserved labels, group `interval`/`query_offset`/`limit` | | Null receivers, mute intervals, inhibit-everything | receivers, `global` hashed into preservation; time intervals are tamper; not-suppressed and bystander cases | | Copying a healthy sibling | hard tier has no healthy sibling burn alerts; structural leak scan | | Postmortem lookup tables | 3-4 paraphrases per symptom, decoy postmortems, defects with no postmortem on hard | | Reward oracle in OpenEnv | `heldout`/`public` splits force outcome-only reward and hide `phi` | ## Related work - [NVlabs/Skill2Env](https://github.com/NVlabs/Skill2Env): the SkillHub `sre-engineer` skill contains a literal 14.4x burn-rate rule, and `slo-architect` covers burn-rate alerting. We downloaded ten SRE-adjacent Skill2Env tasks. The closest one (`task_slo-architect_lgre556n`) grades burn-rate policy by comparing YAML fields, and none run promtool or amtool. - [camel-ai/seta-env](https://github.com/camel-ai/seta-env) task 1114: Alertmanager routing and inhibition checked with amtool. 3amBench's routing checks are end-to-end: the chain case routes the labels the agent's own alert carries. - Community rule sets: [samber/awesome-prometheus-alerts](https://github.com/samber/awesome-prometheus-alerts), [kubernetes-mixin](https://github.com/kubernetes-monitoring/kubernetes-mixin); Google SRE Workbook ch. 5. ## Limitations - Traffic is synthetic (diurnal shape plus jitter), and services are fictional. - Inhibition is graded by a strict simulator of Alertmanager's semantics, not by the Alertmanager process. Unsupported constructs fail closed. - Seven alert templates host the defects, not a large upstream corpus. - The routing chain case uses the agent's static labels, not labels observed in `ALERTS`. - The easy tier may saturate for frontier models; this is unmeasured. - **Contamination:** SkillHub skills (and any skill-augmented agent) already contain near-identical burn-rate recipes, and this repo ships solutions. Evaluate on a private-seed build, and report whether the agent had `SKILL.md`. - English only. ## Repository layout `tasks/` (Harbor tasks) · `registry.json` (`3ambench`, `3ambench-mini`) · `manifest.jsonl` (one row per task) · `partial/`, `null/` (reference policies) · `skill/`, `workflows/` · `generator/generate.py` + `src/alertforge/` (the generator and grader source) · `openenv/alertforge_env/` (OpenEnv server) · `space/` (static replay viewer) · `scripts/` · `tests/` (pytest). ## License and citation Apache-2.0; see `NOTICE.md` for attribution of adapted community rules (CC BY 4.0 / Apache-2.0). ```bibtex @misc{3ambench2026, title = {3amBench: a behaviorally graded, dense-reward RL environment for Prometheus alerting as code}, year = {2026}, note = {Harbor dataset and OpenEnv environment; generator package alertforge v0.1.0} } ```