Spaces:
Sleeping
Sleeping
| # TRACE β Teaching AI to Fix Production Incidents | |
| > **Triage Β· Response Β· Action Β· Cause Β· Evaluation** | |
| --- | |
| ## π₯ The Problem | |
| **Production incidents cost companies millions per hour.** | |
| When systems break at 3 AM, engineers scramble through dashboards, comb through logs, and guess at root causes. The average MTTR (Mean Time to Resolution) for critical incidents is **4+ hours** β and it's getting worse as systems grow more complex. | |
| Current AI coding agents can write code, but **none of them can operate production infrastructure under pressure.** | |
| Why? Because there's no training ground for it. | |
| --- | |
| ## π‘ The Solution: TRACE | |
| TRACE is the **first RL environment designed to teach AI agents how to respond to production incidents.** | |
| Think of it as a **flight simulator for Site Reliability Engineers** β but for AI. | |
| ``` | |
| Agent observes metrics β inspects systems β diagnoses root cause β executes fix β validates recovery | |
| ``` | |
| One environment. Three difficulty levels. Infinite training runs. | |
| --- | |
| ## π― How It Works | |
| ### The Agent Loop | |
| ``` | |
| βββββββββββββββββββββββββββββββββββββββββββββββ | |
| β LLM Agent β | |
| β "CPU is at 85%... let me check β | |
| β the logs for api_workers" β | |
| ββββββββββββββββββββ¬βββββββββββββββββββββββββββ | |
| β action: inspect_logs("api_workers") | |
| βΌ | |
| βββββββββββββββββββββββββββββββββββββββββββββββ | |
| β TRACE Environment β | |
| β β | |
| β π Metrics π₯οΈ Services π¨ Alerts β | |
| β CPU: 85% api: degraded cpu_high β | |
| β Latency: 500ms β | |
| β β | |
| β π "Traffic spike detected. Scale workers" β | |
| ββββββββββββββββββββ¬βββββββββββββββββββββββββββ | |
| β reward: +1.0 (useful inspection) | |
| βΌ | |
| Agent learns to diagnose β fix β validate | |
| ``` | |
| ### Partial Observability β Like Real Life | |
| The agent sees **symptoms**, not causes: | |
| - β CPU usage, memory, latency, error rates | |
| - β Service statuses (healthy / degraded / down) | |
| - β Alert names | |
| But **root cause is hidden** behind inspection actions β just like a real engineer who has to `grep` the logs. | |
| ### Three Scenarios, Increasing Complexity | |
| | Scenario | What Breaks | Root Cause | How to Fix | | |
| |----------|-------------|------------|------------| | |
| | π’ **Easy** | Traffic spike | Worker overload | Scale horizontally | | |
| | π‘ **Medium** | Cascading failures | Queue memory leak | Restart service | | |
| | π΄ **Hard** | Multi-service outage | DB pool + bad release | Restart DB + rollback | | |
| ### Smart Grading | |
| ```python | |
| score = 0.6 Γ did_you_fix_it + 0.4 Γ how_fast_were_you | |
| ``` | |
| No hand-wavy metrics. Binary success + speed. That's it. | |
| --- | |
| ## ποΈ Technical Design | |
| ### OpenEnv Compliant | |
| TRACE is built to the **OpenEnv specification** β the emerging standard for RL environment benchmarks: | |
| - `pyproject.toml` + `openenv.yaml` β auto-validated | |
| - 4 REST endpoints: `/reset`, `/step`, `/state`, `/health` | |
| - Docker-ready, deploys to HF Spaces in one push | |
| ### Deterministic & Reproducible | |
| Same seed β same metrics β same trajectory. Every time. | |
| This isn't a toy random environment. The scenarios are **hand-crafted to test real incident response patterns** β triage, diagnosis, remediation, validation. | |
| ### Action Space | |
| 10 structured actions using `(type, target, value)` triples: | |
| ``` | |
| inspect_logs("database") β reveals root cause | |
| scale_workers("api_workers", 5) β horizontal scaling | |
| restart_database() β resets connection pool | |
| declare_healthy() β "I fixed it" (terminal) | |
| ``` | |
| --- | |
| ## π Results | |
| Running our benchmark with heuristic agents: | |
| | Scenario | Steps | Grade | Status | | |
| |----------|-------|-------|--------| | |
| | Easy CPU Spike | 3/5 | 0.76 | β Solved | | |
| | Medium Cascade | 3/7 | 0.83 | β Solved | | |
| | Hard Mixed | 4/8 | 0.80 | β Solved | | |
| **Average: 0.80** β and that's with hand-coded heuristics. The ceiling for LLM agents is much higher. | |
| --- | |
| ## π¦Ύ Why This Matters | |
| ### For AI Research | |
| - First standardized benchmark for **operational AI** (not just coding) | |
| - Partial observability forces genuine **reasoning under uncertainty** | |
| - Structured action space enables **reward shaping** without reward hacking | |
| ### For the Industry | |
| - Train agents to reduce MTTR from hours to minutes | |
| - Build **autonomous incident response** systems | |
| - Bridge the gap between "AI writes code" and "AI runs production" | |
| ### For the Hackathon | |
| - β OpenEnv validator passes | |
| - β 28 tests, all green | |
| - β Full inference pipeline with LLM agent | |
| - β Interactive Gradio demo | |
| - β Docker builds and serves | |
| - β Push-to-deploy HF Spaces ready | |
| --- | |
| ## π Demo | |
| ### Live Interactive UI | |
| ``` | |
| python ui.py | |
| β Opens Gradio dashboard at localhost:7861 | |
| β Select scenario, take actions, watch metrics change in real-time | |
| ``` | |
| ### LLM Agent Run | |
| ``` | |
| export HF_TOKEN=your-token | |
| python inference.py | |
| [START] task=easy_cpu_spike env=trace model=openai/gpt-oss-20b | |
| [STEP] step=1 action=inspect_logs(api_workers,) reward=1.00 done=false error=null | |
| [STEP] step=2 action=scale_workers(api_workers,5) reward=5.00 done=false error=null | |
| [STEP] step=3 action=declare_healthy(,) reward=10.00 done=true error=null | |
| [END] success=true steps=3 score=0.840 rewards=1.00,5.00,10.00 | |
| ``` | |
| --- | |
| ## π€ Team | |
| **Rajarshi Datta** β Builder, designer, engineer. | |
| --- | |
| ## π¦ Stack | |
| | Component | Technology | | |
| |-----------|-----------| | |
| | Environment | Python, Pydantic | | |
| | Server | FastAPI, Uvicorn | | |
| | Inference | OpenAI Client, HF Router | | |
| | Model | openai/gpt-oss-20b | | |
| | Deployment | Docker, HF Spaces | | |
| | Demo | Gradio | | |
| | Spec | OpenEnv | | |
| --- | |
| ## One Line | |
| **TRACE teaches AI agents to fix production incidents β the missing benchmark between "AI writes code" and "AI runs production."** | |
| --- | |
| *Built for the Meta Γ PyTorch Γ Hugging Face OpenEnv Hackathon.* | |