CoolFace
Apppublic

samnitmehandiratta/my-env

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

<div align="center">

๐Ÿšจ SRE Incident Triage

Can your AI survive an on-call shift?

An OpenEnv reinforcement learning environment where agents triage real production incidents โ€” reading noisy alerts, tracing cascading failures, and recommending the right fix under pressure.


OpenEnv Docker Tasks-orange?style=for-the-badge) Scores

</div>


๐Ÿง  What Is This?

Every company has an on-call rotation. At 3am, an engineer gets paged โ€” alerts firing, logs streaming, services cascading. They have minutes to find the root cause and act.

This environment turns that into an RL benchmark.

An AI agent receives the same raw signals a human SRE would see: production alerts, service logs, and real-time metrics. It must investigate, diagnose, and resolve โ€” just like a real engineer would.

Unlike toy environments, this one models a task where reasoning quality directly determines the score. LLMs that have absorbed engineering knowledge genuinely outperform those that haven't.

๐ŸŽฏ Three Incident Scenarios

EASY โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ HARD
  โ”‚                    โ”‚                            โ”‚
  โ–ผ                    โ–ผ                            โ–ผ
cpu_spike       cascading_failure            memory_leak
๐Ÿท๏ธ Task๐ŸŽš๏ธ Difficulty๐Ÿ’ฅ Incident๐Ÿ” What Agent Must Find
cpu_spike๐ŸŸข EasyTraffic flood hitting api-serverNo rate limiting, IP making 8K req/min
cascading_failure๐ŸŸก Medium4 services down in a cascadepayment-service v2.3.1 set DB pool to 500 (was 10)
memory_leak๐Ÿ”ด HardMulti-service OOM kills over 2hShared logging-middleware v2.1.0 never flushes its buffer

โšก Agent Action Space

The agent speaks JSON โ€” clean, structured, LLM-native:

json
// ๐Ÿ” Drill into a specific service
{"action_type": "investigate", "service": "payment-service"}

// ๐Ÿฉบ Submit your diagnosis
{
  "action_type": "diagnose",
  "severity": "critical",
  "root_cause": "DB connection pool exhausted after v2.3.1 deploy",
  "affected_services": ["payment-service", "checkout-service"]
}

// ๐Ÿ› ๏ธ Recommend the fix (highest scoring action)
{
  "action_type": "resolve",
  "severity": "critical",
  "root_cause": "payment-service v2.3.1 set DB_POOL_SIZE=500, exceeding DB max_connections=100",
  "affected_services": ["payment-service", "checkout-service", "order-service"],
  "recommended_action": "rollback payment-service to v2.3.0 and restart connection pool"
}

// โœ… End episode
{"action_type": "done"}

๐Ÿ‘๏ธ Observation Space

Every step, the agent sees:

json
{
  "alerts": [
    "CRITICAL: payment-service health check failing (0% healthy pods)",
    "HIGH: checkout-service error rate at 78%"
  ],
  "logs": [
    "16:44:30 INFO  deployment: payment-service v2.3.1 rolled out",
    "16:44:31 ERROR payment-service: Failed to acquire DB connection (pool exhausted)",
    "16:45:02 ERROR checkout-service: payment-service call timed out after 3000ms"
  ],
  "metrics": {
    "payment-service": {"cpu_percent": 12, "error_rate": 100, "healthy_pods": 0},
    "payment-db":      {"cpu_percent": 98, "active_connections": 500, "max_connections": 100}
  },
  "step": 2,
  "additional_info": null  // populated after investigate actions
}

๐Ÿ“Š Reward Function

Scores are partial โ€” every step provides signal, not just the final answer:

ComponentMax WeightHow It's Earned
๐ŸŽš๏ธ Severity classification+0.30Exact match: critical / high / medium / low
๐Ÿ”Ž Root cause accuracy+0.45Keyword matching โ€” partial credit per relevant term
๐Ÿ—‚๏ธ Affected services+0.05Any services identified
๐Ÿ› ๏ธ Recommended action+0.25Keyword match on correct remediation
All scores clamped to (0.01, 0.99) โ€” never binary, always informative.

Strategy that works best: investigate โ†’ investigate โ†’ resolve (2-step exploration before committing)


๐Ÿ“ˆ Baseline Results

Tested with Qwen/Qwen2.5-72B-Instruct via HuggingFace Router:

cpu_spike          โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘  0.92  โœ… Success
cascading_failure  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘  0.96  โœ… Success
memory_leak        โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  0.66  โœ… Success

The hard task (memory_leak) genuinely challenges frontier models โ€” the shared component spans 4 services with no obvious single alert.


๐Ÿš€ Quick Start

bash
# Clone and build
git clone https://github.com/samnitmehandiratta/my-openenv
cd my-openenv
docker build -t sre-triage .

# Run
docker run -p 7860:7860 \
  -e HF_TOKEN=hf_... \
  -e API_BASE_URL=https://router.huggingface.co/v1 \
  -e MODEL_NAME=Qwen/Qwen2.5-72B-Instruct \
  sre-triage

๐Ÿ”Œ API Endpoints

MethodEndpointDescription
POST/resetStart new episode โ€” body: {"task": "cpu_spike"}
POST/stepTake action โ€” body: {"action": {...}}
GET/stateCurrent episode state

๐Ÿงช Run Inference Locally

bash
HF_TOKEN=hf_... \
API_BASE_URL=https://router.huggingface.co/v1 \
MODEL_NAME=Qwen/Qwen2.5-72B-Instruct \
python inference.py

<div align="center">

Built for the Scaler ร— HuggingFace OpenEnv Hackathon 2025

Because the best RL environments are the ones where intelligence actually matters.

</div>