trace / docs /pitch.md
mrmarvelous's picture
Upload folder using huggingface_hub
3d77779 verified
|
Raw
History Blame Contribute Delete
6.64 kB
# 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.*