๐Ÿšจ Incident Response Environment

An OpenEnv-compliant RL benchmark where AI agents diagnose production microservices failures

OpenEnv HuggingFace License Docker Python Blog

LLM agents act as on-call Site Reliability Engineers, investigating simulated production incidents under partial observability, time pressure, and cascading failures.

๐ŸŽฎ Live Dashboard ยท ๐Ÿ“– Environment Docs ยท ๐Ÿ“Š Benchmark Guide ยท ๐Ÿค– Agent Guide ยท ๐Ÿ† Reward Design


๐ŸŽฏ Overview

When production systems fail at 3 AM, engineers must quickly investigate cascading failures across distributed microservices to identify the root cause. This environment simulates that exact challenge โ€” a gym-compatible RL benchmark where agents must:


โœจ Key Features

Production-Ready Implementation

โœ… 16 Incident Tasks โ€” CPU spikes, memory leaks, database deadlocks, SSL cert expiry, multi-fault scenarios, long-horizon planning
โœ… 7 Action Types โ€” read_logs, check_metrics, check_health, run_db_query, restart_service, rollback_deployment, declare_rca
โœ… 6 Microservices โ€” API gateway (victim), auth, orders, notifications, Redis cache, PostgreSQL database
โœ… Multi-Fault Support โ€” Dual independent failures (e.g., Redis + Auth both failing)
โœ… Cascade Mechanics โ€” Secondary failures triggered at specific episode steps
โœ… Red Herrings โ€” Services with suspicious metrics but NOT the root cause
โœ… Long-Horizon Planning โ€” 50-step episodes testing sustained reasoning ability

Advanced Reward Shaping

โœ… Evidence-Based Rewards โ€” Investigation actions earn +0.10 to +0.18 per unique evidence type
โœ… Sequence Bonuses โ€” Fixes with prior evidence get up to 1.0x multiplier (blind fixes: 0.0x)
โœ… Redundancy Penalties โ€” Repeating actions escalates penalties (-0.08 โ†’ -0.20)
โœ… Efficiency Bonuses โ€” Faster solutions score higher (up to +0.30 for time saved)
โœ… RCA Rewards โ€” Correct diagnosis: +0.50 base + bonuses, Wrong: -0.40 penalty
โœ… Domain-Aware Dispatch โ€” Microservices, CI/CD, and Kafka reward functions

Interactive Gradio Dashboard

โœ… Real-Time Playground โ€” Manual testing interface with live action/observation display
โœ… Custom Model Benchmarking โ€” Load any HuggingFace model for real LLM inference evaluation
โœ… Leaderboard Visualization โ€” Compare model performance across all tasks from benchmark.json
โœ… About Page โ€” Full project documentation and architecture overview
โœ… Premium Dark Theme โ€” Sleek UI with amber accents and smooth micro-interactions
โœ… CPU-Safe Model Loading โ€” Detailed error diagnostics with graceful fallback

Comprehensive Tooling

โœ… Expert Agent โ€” Rule-based baseline achieving >0.80 on all tasks (training/expert_agent.py)
โœ… SFT Data Generator โ€” Export expert trajectories as trajectories.jsonl for supervised fine-tuning
โœ… Benchmark Runner โ€” Automated evaluation harness with persistent leaderboard (benchmark_runner.py)
โœ… REST API โ€” OpenEnv-compliant FastAPI server with full endpoint coverage (server/app.py)
โœ… LLM Judge โ€” Adversarial evaluation with phase-order enforcement (judge/llm_judge.py)
โœ… Multi-Provider LLM Client โ€” OpenAI, Anthropic, Mock fallback with retry logic (judge/llm_client.py)


๐Ÿš€ Quick Start

Option 1: Local Development

# Clone repository
git clone https://github.com/yourusername/incident-response-env
cd incident-response-env

# Install dependencies
pip install -e .

# Start the server (includes FastAPI + Gradio dashboard)
uvicorn server.app:app --host 0.0.0.0 --port 7860

Open the dashboard: http://localhost:7860/dashboard

Option 2: Docker

docker build -t incident-response-env .
docker run -p 7860:7860 incident-response-env

Option 3: Run Benchmark Evaluation

Configure your LLM provider and run automated benchmark:

Bash:

export API_BASE_URL="https://api.openai.com/v1"
export API_KEY="sk-YOUR_OPENAI_KEY"
export MODEL_NAME="gpt-4o"

python inference.py

PowerShell:

$env:API_BASE_URL="https://api.openai.com/v1"
$env:API_KEY="sk-YOUR_OPENAI_KEY"
$env:MODEL_NAME="gpt-4o"

python inference.py

Supported providers: OpenAI, Anthropic (via LiteLLM), HuggingFace Inference, Together AI, Ollama (local)


๐Ÿ“‹ Task Suite (16 Scenarios)

All tasks test incident response skills with varying difficulty levels, from shallow (10 steps) to long-horizon planning (50 steps):

Task ID Difficulty Max Steps Root Cause Challenge Type
task_cpu_spike Easy 10 Auth service CPU hot loop Basic investigation
task_disk_full Easy 12 Postgres disk space exhaustion Resource limits
task_db_connection_leak Medium 15 Order-service connection pool leak Connection management
task_redis_memory_eviction Medium 15 Redis memory threshold cascade Cache management
task_api_rate_limit Medium 12 API gateway rate limit config Gateway investigation
task_deadlock_order_service Medium 15 Database deadlock in orders Database locks
task_ssl_cert_expired Hard 18 SSL certificate expiration Certificate management
task_slow_query_postgres Hard 18 Slow query blocking pool Query optimization
task_auth_service_500 Hard 20 Auth service internal errors Error investigation
task_k8s_pod_crashloop Hard 20 Kubernetes pod crash loop Container orchestration
task_memory_leak Hard 20 Service memory leak OOM Memory profiling
task_thread_starvation Hard 20 Thread pool starvation Concurrency issues
task_canary_poison Expert 25 Canary deployment config bug Deployment strategies
task_clock_skew Expert 25 System clock skew across services Distributed systems
task_expert Expert 25 Multi-fault: Redis + Auth Multiple root causes
task_expert_long_horizon Expert 50 Latent cascade at step 35+ Long-horizon planning

๐ŸŽฏ Special Task: task_expert_long_horizon

Tests true long-horizon reasoning over 50 steps:

Why this matters: Reveals whether agents develop genuine SRE reasoning vs. pattern-matching quick fixes.


๐ŸŽฎ Action Space

Agents have 7 distinct action types for investigation and remediation:

{"action_type": "read_logs",           "target": "auth-service"}
{"action_type": "check_metrics",       "target": "redis-cache"}
{"action_type": "check_health",        "target": "order-service"}
{"action_type": "run_db_query",        "target": "postgres-db"}
{"action_type": "restart_service",     "target": "notification-service"}
{"action_type": "rollback_deployment", "target": "order-service"}
{"action_type": "declare_rca",         "target": "redis-cache"}

Available Services


๐Ÿ“Š Observation Space

Every action returns a structured observation with:

Field Type Description
message string Current observation text (logs, metrics, health status, query results)
step int Current step number in episode
done bool Episode finished flag
alert string Original incident alert description
metrics object Service metrics (CPU, memory, connections) if requested
current_reward float Reward for last action taken
cumulative_reward float Total accumulated reward

๐Ÿ† Reward System

The environment uses a domain-aware reward function (reward.py) with sophisticated evidence tracking:

Evidence-Based Investigation Rewards

Action Type Reward Notes
read_logs +0.10 to +0.18 Higher reward for relevant service
check_metrics +0.10 to +0.15 CPU, memory, connection stats
check_health +0.08 to +0.12 Service status check
run_db_query +0.12 to +0.18 Database investigation

Intervention Rewards

Action Type Correct Wrong
restart_service +0.30 + bonuses -0.30
rollback_deployment +0.30 + bonuses -0.30
declare_rca +0.50 + bonuses -0.40

Bonus Modifiers

Evidence Bonus (0 to +0.20):

Efficiency Bonus (0 to +0.30):

Sequence Multiplier (0.0x to 1.0x):

Redundancy Penalties

Timing Penalty Notes
Early episode (< 50% steps) -0.08 Gentle penalty for exploration
Late episode (โ‰ฅ 50% steps) -0.20 Harsh penalty for inefficiency

Score Clamping

Final scores are clamped to [0.001, 0.999] to prevent:

Example Score Calculations

Fast Expert Solve (0.88):

Base RCA:        +0.50
Evidence bonus:  +0.20 (4 evidence types)
Efficiency bonus: +0.18 (solved in 4/10 steps)
Total:           0.88

Slower Correct Solve (0.72):

Base RCA:        +0.50
Evidence bonus:  +0.10 (2 evidence types)
Efficiency bonus: +0.06 (solved in 8/10 steps)
Investigation:   +0.06 (from evidence gathering)
Total:           0.72

Wrong Diagnosis (-0.40):

Incorrect RCA:   -0.40 (hard penalty for guessing)

๐ŸŽจ Gradio Dashboard

The interactive dashboard provides:

1. Manual Playground

2. Custom Model Benchmarking

# Dashboard automatically handles:
# 1. HuggingFace model loading (transformers pipeline)
# 2. Real LLM inference (no mock data)
# 3. CPU-safe execution with error diagnostics
# 4. Progress tracking across all 16 tasks
# 5. JSON results export

Supported models:

Example usage in dashboard:

  1. Enter model ID: meta-llama/Llama-2-7b-chat-hf
  2. Configure max tokens, temperature
  3. Click "Run Benchmark"
  4. View real-time progress
  5. Download results JSON

3. Leaderboard

4. About Page

Dashboard Startup

# Option 1: Via FastAPI server (recommended)
uvicorn server.app:app --host 0.0.0.0 --port 7860
# Dashboard available at: http://localhost:7860/dashboard

# Option 2: Standalone Gradio
python server/gradio_app.py
# Dashboard available at: http://localhost:7860

๐Ÿ”Œ REST API Reference

The FastAPI server (server/app.py) provides OpenEnv-compliant endpoints:

Core Endpoints

POST /reset

Start a new episode for a specific task.

Request:

{
  "task_id": "task_expert"
}

Response:

{
  "observation": "Alert: High error rate detected on API Gateway...",
  "step": 0,
  "done": false,
  "alert": "High error rate detected...",
  "current_reward": 0.0,
  "cumulative_reward": 0.0
}

POST /step

Execute one action in the current episode.

Request:

{
  "action_type": "read_logs",
  "target": "auth-service"
}

Response:

{
  "observation": "Auth service logs show JWT validation errors...",
  "step": 1,
  "done": false,
  "current_reward": 0.15,
  "cumulative_reward": 0.15,
  "metrics": {
    "cpu_percent": 85.3,
    "memory_mb": 1024,
    "connections": 150
  }
}

GET /grade

Get final episode score.

Response:

{
  "score": 0.88,
  "task_id": "task_expert",
  "solved": true
}

GET /state

Get ground truth state (debug only โ€” spoils the answer).

Response:

{
  "root_cause_service": "redis-cache",
  "secondary_faults": ["auth-service"],
  "red_herrings": ["notification-service"],
  "fault_type": "memory_eviction",
  "cascade_step": 15
}

GET /tasks

List all available tasks.

Response:

{
  "tasks": [
    {
      "id": "task_cpu_spike",
      "difficulty": "easy",
      "max_steps": 10,
      "description": "Auth service CPU hot loop"
    },
    ...
  ]
}

GET /health

Liveness check for monitoring.

Response:

{
  "status": "healthy",
  "version": "1.0.0"
}

Complete API Example (Bash)

# 1. Start episode
curl -X POST http://localhost:7860/reset \
  -H "Content-Type: application/json" \
  -d '{"task_id": "task_expert"}'

# 2. Investigate logs
curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{"action_type": "read_logs", "target": "api-gateway"}'

# 3. Check metrics
curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{"action_type": "check_metrics", "target": "redis-cache"}'

# 4. Declare RCA
curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{"action_type": "declare_rca", "target": "redis-cache"}'

# 5. Get final score
curl http://localhost:7860/grade

Complete API Example (PowerShell)

# 1. Start episode
$body = @{task_id = "task_expert"} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:7860/reset" -Method POST -ContentType "application/json" -Body $body

# 2. Investigate logs
$body = @{action_type = "read_logs"; target = "api-gateway"} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:7860/step" -Method POST -ContentType "application/json" -Body $body

# 3. Check metrics
$body = @{action_type = "check_metrics"; target = "redis-cache"} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:7860/step" -Method POST -ContentType "application/json" -Body $body

# 4. Declare RCA
$body = @{action_type = "declare_rca"; target = "redis-cache"} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:7860/step" -Method POST -ContentType "application/json" -Body $body

# 5. Get final score
Invoke-RestMethod -Uri "http://localhost:7860/grade"

๐Ÿ—๏ธ Architecture

System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Gradio Dashboard (Dark Theme + Amber UI)        โ”‚
โ”‚  Manual Playground | Custom Benchmarking | Leaderboard  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         FastAPI Server (server/app.py)                  โ”‚
โ”‚  /reset | /step | /grade | /state | /tasks | /health   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      IncidentResponseEnv (environment.py)               โ”‚
โ”‚  State management | Task dispatch | Trajectory logging  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Reward System (reward.py - Domain-Aware)              โ”‚
โ”‚  โ€ข EvidenceTracker: Multi-type evidence collection      โ”‚
โ”‚  โ€ข Domain dispatch: Microservices | CI/CD | Kafka       โ”‚
โ”‚  โ€ข Sequence bonuses | Redundancy penalties | RCA scoringโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Supporting Components                                  โ”‚
โ”‚  โ€ข models.py: Pydantic data models                      โ”‚
โ”‚  โ€ข task_config.py: Task registry                        โ”‚
โ”‚  โ€ข simulators/: CI/CD + Kafka state machines            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

File Structure

incident-response-env/
โ”‚
โ”œโ”€โ”€ Core Environment
โ”‚   โ”œโ”€โ”€ environment.py          # Main Gym environment
โ”‚   โ”œโ”€โ”€ models.py               # Pydantic data models
โ”‚   โ”œโ”€โ”€ reward.py               # Domain-aware reward function
โ”‚   โ””โ”€โ”€ task_config.py          # Task ID registry
โ”‚
โ”œโ”€โ”€ Server & UI
โ”‚   โ”œโ”€โ”€ server/
โ”‚   โ”‚   โ”œโ”€โ”€ app.py              # FastAPI REST API
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard_impl.py   # Gradio dashboard implementation
โ”‚   โ”‚   โ””โ”€โ”€ gradio_app.py       # Standalone Gradio launcher
โ”‚   โ””โ”€โ”€ app.py                  # Gradio entry point wrapper
โ”‚
โ”œโ”€โ”€ Evaluation & Training
โ”‚   โ”œโ”€โ”€ inference.py            # LLM agent benchmark runner
โ”‚   โ”œโ”€โ”€ benchmark_runner.py     # Full benchmark orchestration
โ”‚   โ””โ”€โ”€ training/
โ”‚       โ”œโ”€โ”€ expert_agent.py     # Rule-based expert (>0.80 on all tasks)
โ”‚       โ””โ”€โ”€ generate_data.py    # SFT trajectory generator
โ”‚
โ”œโ”€โ”€ LLM Infrastructure
โ”‚   โ””โ”€โ”€ judge/
โ”‚       โ”œโ”€โ”€ llm_client.py       # Multi-provider client (OpenAI/Anthropic/Mock)
โ”‚       โ””โ”€โ”€ llm_judge.py        # Adversarial evaluation with phase enforcement
โ”‚
โ”œโ”€โ”€ Simulators (Future Expansion)
โ”‚   โ””โ”€โ”€ simulators/
โ”‚       โ”œโ”€โ”€ cicd_simulator.py   # CI/CD pipeline state machine
โ”‚       โ””โ”€โ”€ kafka_simulator.py  # Kafka cluster state machine
โ”‚
โ”œโ”€โ”€ Tasks & Data
โ”‚   โ”œโ”€โ”€ tasks/
โ”‚   โ”‚   โ”œโ”€โ”€ cicd_tasks.json     # CI/CD task definitions
โ”‚   โ”‚   โ””โ”€โ”€ kafka_tasks.json    # Kafka task definitions
โ”‚   โ””โ”€โ”€ sft_data/
โ”‚       โ”œโ”€โ”€ trajectories.jsonl  # Generated training data
โ”‚       โ””โ”€โ”€ generation_stats.json
โ”‚
โ”œโ”€โ”€ Testing
โ”‚   โ”œโ”€โ”€ test/                   # Integration tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_api_tasks.py
โ”‚   โ”‚   โ”œโ”€โ”€ test_full_episode.py
โ”‚   โ”‚   โ”œโ”€โ”€ test_inference_tasks.py
โ”‚   โ”‚   โ””โ”€โ”€ verify_inference_tasks.py
โ”‚   โ””โ”€โ”€ tests/                  # Unit tests (pytest)
โ”‚       โ”œโ”€โ”€ conftest.py
โ”‚       โ”œโ”€โ”€ test_environment.py
โ”‚       โ”œโ”€โ”€ test_llm_client.py
โ”‚       โ”œโ”€โ”€ test_llm_judge.py
โ”‚       โ””โ”€โ”€ test_reward.py
โ”‚
โ”œโ”€โ”€ Documentation
โ”‚   โ””โ”€โ”€ docs/
โ”‚       โ”œโ”€โ”€ AGENT.md            # Agent operating manual
โ”‚       โ”œโ”€โ”€ BENCHMARK.md        # Benchmarking guide
โ”‚       โ”œโ”€โ”€ DESIGN.md           # Design philosophy
โ”‚       โ”œโ”€โ”€ ENVIRONMENT.md      # Environment specification
โ”‚       โ”œโ”€โ”€ REWARDS.md          # Reward engineering
โ”‚       โ””โ”€โ”€ SKILLS.md           # Agent capability taxonomy
โ”‚
โ”œโ”€โ”€ Configuration
โ”‚   โ”œโ”€โ”€ Dockerfile              # Production container
โ”‚   โ”œโ”€โ”€ pyproject.toml          # Python package config
โ”‚   โ”œโ”€โ”€ requirements.txt        # Dependencies
โ”‚   โ”œโ”€โ”€ openenv.yaml            # OpenEnv specification
โ”‚   โ””โ”€โ”€ start.sh                # Docker startup script
โ”‚
โ””โ”€โ”€ README.md                   # This file

๐Ÿค– LLM Judge & Multi-Provider Support

LLM Judge (judge/llm_judge.py)

Adversarial evaluation with phase-order enforcement:

Judge scoring criteria:

Multi-Provider LLM Client (judge/llm_client.py)

Supports multiple LLM providers with unified interface:

Provider Configuration Example
OpenAI API_BASE_URL=https://api.openai.com/v1 gpt-4o, gpt-4-turbo
Anthropic API_BASE_URL=https://api.anthropic.com/v1 claude-3-opus-20240229
HuggingFace API_BASE_URL=https://api-inference.huggingface.co/v1 meta-llama/Llama-2-70b
Together AI API_BASE_URL=https://api.together.xyz/v1 mistralai/Mixtral-8x7B
Ollama API_BASE_URL=http://localhost:11434/v1 Any local model
Mock Automatic fallback if no API key Deterministic responses

Features:


๐Ÿ“Š Baseline Performance & Agent Taxonomy

Agent Capability Tiers

Level Score Range Behavior Example
0 โ€” Random Walker 0.00โ€“0.15 Repeats actions, never declares RCA Random policy
1 โ€” Symptom Chaser 0.15โ€“0.40 Exhaustively checks all services Breadth-first search
2 โ€” Structured Investigator 0.40โ€“0.70 Finds right service, wrong fix/timing GPT-3.5 baseline
3 โ€” Expert SRE 0.70โ€“1.00 Evidence โ†’ Hypothesis โ†’ Fix โ†’ RCA Expert agent, GPT-4o

Baseline Results

Agent Easy Tasks Medium Tasks Hard Tasks Expert Tasks Avg Score
Random 0.12 0.08 0.05 0.03 0.07
Expert (Rule-based) 0.92 0.87 0.83 0.81 0.86
GPT-4o 0.88 0.75 0.62 0.54 0.70
GPT-3.5-turbo 0.65 0.48 0.32 0.21 0.42

Key insights:


๐ŸŽ“ Training & SFT Data Generation

Expert Agent (training/expert_agent.py)

Rule-based agent that serves as strong baseline and SFT data source:

Strategy:

  1. Always start with gateway: Read logs to identify upstream fault
  2. Follow dependency chain: Trace to suspect service
  3. Gather all evidence: Logs, metrics, health, queries (if DB-related)
  4. Apply correct fix type: Restart for runtime errors, rollback for deployment issues
  5. Declare RCA: Only after gathering 3+ evidence types

Performance: >0.80 on all 16 tasks

SFT Data Generator (training/generate_data.py)

Exports expert trajectories in JSONL format for supervised fine-tuning:

python run_generate_data.py --num_episodes 100 --output sft_data/trajectories.jsonl

Output format:

{
  "task_id": "task_expert",
  "trajectory": [
    {"step": 0, "action": {"action_type": "read_logs", "target": "api-gateway"}, "observation": "...", "reward": 0.15},
    {"step": 1, "action": {"action_type": "check_metrics", "target": "redis-cache"}, "observation": "...", "reward": 0.12},
    ...
  ],
  "total_reward": 0.88,
  "final_score": 0.88,
  "rca_correct": true
}

Use cases:


๐Ÿ† Benchmark Runner

Automated Evaluation (benchmark_runner.py)

Run comprehensive benchmarks across all tasks and models:

python benchmark_runner.py \
  --model gpt-4o \
  --episodes_per_task 5 \
  --output benchmark.json

Output format (benchmark.json):

{
  "leaderboard": [
    {
      "agent": "gpt-4o",
      "scores": {
        "task_cpu_spike": 0.92,
        "task_expert": 0.54,
        ...
      },
      "average": 0.70,
      "solved": 10,
      "rank": 1
    }
  ],
  "timestamp": "2026-04-26T14:30:00Z"
}

Leaderboard ranking:


๐Ÿ”ฌ Advanced Features

Multi-Fault Support

Task task_expert includes dual independent failures:

Cascade Mechanics

Secondary faults emerge mid-episode:

Red Herrings

Deliberately misleading symptoms:

Purpose: Test agent's ability to distinguish correlation from causation

Partial Observability

Agent sees only what it queries:


๐Ÿšข Deployment & Production

Docker Deployment

Dockerfile includes:

Build and run:

docker build -t incident-response-env .
docker run -p 7860:7860 incident-response-env

Environment Variables

Variable Description Default
API_BASE_URL LLM provider endpoint https://api.openai.com/v1
API_KEY API key for LLM provider Required
MODEL_NAME Model identifier gpt-4o
DASHBOARD_PORT Gradio dashboard port 7860
LOG_LEVEL Logging verbosity INFO

CI/CD Integration

GitHub Actions example:

name: Benchmark Agent
on: [pull_request]

jobs:
  benchmark:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - run: pip install -e .
      - env:
          API_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
          API_KEY: ${{ secrets.OPENAI_API_KEY }}
          MODEL_NAME: gpt-4o
        run: |
          uvicorn server.app:app --host 0.0.0.0 --port 7860 &
          sleep 5
          python inference.py
      - uses: actions/upload-artifact@v3
        with:
          name: benchmark-results
          path: benchmark.json

๐Ÿ“š Documentation

Document Description
AGENT.md Complete agent operating manual with optimal strategies
BENCHMARK.md Multi-model benchmarking guide and result interpretation
DESIGN.md Design philosophy and architectural decisions
ENVIRONMENT.md Full API reference and task definitions
REWARDS.md Reward engineering philosophy and tuning guide
SKILLS.md Agent capability taxonomy and prompt engineering

๐Ÿค Contributing

We welcome contributions! Areas of interest:

New Fault Scenarios

Additional Services

Improved Agents

Tooling Enhancements

See ENVIRONMENT.md for extension guide.


๐Ÿ“ˆ Real-World Impact

Who benefits from solving this benchmark?

Market context:


๐Ÿ… OpenEnv Compliance

This environment implements the OpenEnv Specification v1.0:

โœ… Standardized REST API (/reset, /step, /grade, /state, /tasks)
โœ… Structured observations with done flag and reward signals
โœ… Task registry with difficulty levels and descriptions
โœ… Reproducible episodes with fixed random seeds
โœ… Documented action/observation spaces
โœ… OpenEnv manifest (openenv.yaml)

Manifest highlights:

environment:
  name: "Incident Response Environment"
  version: "1.0.0"
  domain: "microservices_sre"
  
tasks:
  count: 16
  difficulty_levels: ["easy", "medium", "hard", "expert"]
  
action_space:
  type: "discrete"
  cardinality: 42  # 7 action types ร— 6 services
  
observation_space:
  type: "text"
  partial_observability: true

๐Ÿ“„ License

Apache 2.0 โ€” Free for research, commercial use, and derivative works.

See LICENSE for full terms.


๐Ÿ™ Acknowledgments

Built for the OpenEnv ร— Scaler Hackathon 2026 with the goal of making AI agents reliable enough to be your on-call engineer.

Special thanks to:


๐Ÿšจ Making AI Reliable Enough to Be Your On-Call Engineer ๐Ÿšจ

๐ŸŽฎ Try Live Demo ยท ๐Ÿ“– Read the Docs ยท ๐Ÿ› Report Bug ยท ๐Ÿ’ก Request Feature

โญ Star this repo if you find it useful!

--- title: Incident Response Env emoji: ๐Ÿšจ colorFrom: red colorTo: blue sdk: docker pinned: false license: apache-2.0 short_description: LLM agents act as on-call SREs. ---

๐Ÿšจ Incident Response Environment

The benchmark where AI becomes your on-call engineer

OpenEnv HuggingFace License Docker Blog

An OpenEnv-compliant reinforcement learning benchmark where LLM agents must diagnose cascading microservices failures โ€” just like a real Site Reliability Engineer would.

โœ… Phase 1-5 Complete โ€” Full environment with RL training, multi-LLM support, and trajectory logging.

๐ŸŽฎ Live Demo ยท ๐Ÿ“– Environment Docs ยท ๐Ÿ“Š Benchmark Guide ยท ๐Ÿค– Agent Guide ยท ๐Ÿ† Reward Design


Production Incident Response Environment

An OpenEnv-compliant RL environment where LLM agents act as on-call SREs, investigating simulated microservices failures to identify root causes under time pressure.

Why this environment exists

Every tech company running software in production has incidents. A database slows down, an API starts throwing 500 errors, users cannot log in. The on-call engineer must investigate noisy, incomplete signals and identify the root cause as fast as possible. This environment simulates that exact task.


๐ŸŒ Why This Problem Matters

Every major tech company loses an average of $300,000 per hour during production incidents. (Gartner, 2023 โ€” IT Downtime Cost Report)

When production goes down, an on-call SRE receives a pager alert at 3 AM. They have minutes โ€” not hours โ€” to investigate a cascade of noisy, incomplete signals across dozens of microservices, form a hypothesis, apply the right fix, and declare a root cause. Getting it wrong means extended downtime, lost revenue, and user churn.

This is not a solved problem. Current AI systems cannot reliably perform sequential diagnostic reasoning under:

incident-response-env is the first OpenEnv-compliant RL benchmark built around this exact challenge.


๐ŸŽฏ What Makes This Different

Benchmark Type What It Tests Limitation
Static Q&A Knowledge recall No sequential decisions
Code generation Single-turn output No feedback loop
Tool-use benchmarks Tool calling No partial observability
incident-response-env Sequential diagnosis under uncertainty None โ€” this is real SRE work

Unlike benchmarks where the agent sees everything at once, here the agent only knows what it queries. It must build a mental model of a broken system step by step โ€” exactly as a human engineer would.


๐Ÿ†• Recent Enhancements (Phase 1-5)

Multi-LLM Support with Resilient Fallbacks

Trajectory Logging & SFT Data Collection

Enhanced Service Simulation

Phase 4 Domain-Aware Reward System

Phase 1-2 Experimental Extensions

See docs/ENVIRONMENT.md for simulator roadmap.


๐ŸŽฎ Action Space

The agent has 7 distinct action types, each with a specific diagnostic or remediation purpose:

{"action_type": "read_logs",           "target": "<service>"}
{"action_type": "check_metrics",       "target": "<service>"}
{"action_type": "check_health",        "target": "<service>"}
{"action_type": "run_db_query",        "target": "postgres-db"}
{"action_type": "restart_service",     "target": "<service>"}
{"action_type": "rollback_deployment", "target": "<service>"}
{"action_type": "declare_rca",         "target": "<service>"}

Available services: api-gateway ยท auth-service ยท order-service ยท notification-service ยท redis-cache ยท postgres-db

Observation space

Every action returns a rich observation:

Field Type Description
message string Current observation text
step int Current step number
done bool Episode finished
alert string Original incident alert
metrics object Service metrics (if requested)

๐Ÿ“‹ Task Suite

16 carefully crafted incident scenarios of increasing difficulty, from shallow (10 steps) to long-horizon planning (50 steps):

Task Difficulty Max Steps Description
task_cpu_spike Easy 10 Auth service CPU hot loop
task_disk_full Easy 12 Disk space exhaustion on postgres
task_db_connection_leak Medium 15 Order-service connection pool exhaustion
task_redis_memory_eviction Medium 15 Redis memory threshold eviction cascade
task_api_rate_limit Medium 12 API gateway rate limiter misconfiguration
task_deadlock_order_service Medium 15 Database deadlock in order-service
task_ssl_cert_expired Hard 18 SSL certificate expiration cascade
task_slow_query_postgres Hard 18 Slow query blocking connection pool
task_auth_service_500 Hard 20 Auth service internal server errors
task_k8s_pod_crashloop Hard 20 Kubernetes pod crash loop
task_memory_leak Hard 20 Service memory leak causing OOM
task_thread_starvation Hard 20 Thread pool starvation in microservice
task_canary_poison Expert 25 Canary deployment strips auth headers
task_clock_skew Expert 25 System clock skew across services
task_expert Expert 25 Multi-root-cause: Redis + Auth failures
task_expert_long_horizon Expert 50 Long-horizon cascade: Latent secondary fault at step 35+

๐Ÿš€ Long-Horizon Planning Test: task_expert_long_horizon

Addresses Hackathon Theme #2: Long-Horizon Planning

This 50-step task forces agents beyond shallow next-token reasoning:

Why this matters: Tests whether agent can maintain context, plan ahead, and avoid optimization traps. A 50-step episode reveals whether the agent develops genuine SRE reasoning vs. pattern-matching lucky guesses.

๐ŸŸก Sample Scenario: Bad Deployment Cascade (Red Herring)

"Order service started failing after the 14:30 deployment. Auth service appears degraded."

A bad deployment on order-service cascades to make auth-service appear broken โ€” a deliberate red herring. Logs show missing environment variables. The correct fix is rollback. Tests: Red herring resistance, multi-service correlation.


๐Ÿ”ฌ The Simulated Microservices System

The agent investigates a 6-service production stack comprising an api-gateway (always a victim), auth-service, order-service, notification-service, redis-cache, and postgres-db.

Key design principle: The gateway is always a victim, never the root cause. This forces agents to trace causality upstream.


Reward function

๐Ÿ“Š Baseline Performance

Model task_easy task_medium task_hard Avg Score Solved
Random agent ~0.15 ~0.08 ~0.04 ~0.09 0/3
Qwen2.5-72B ~0.75 ~0.60 ~0.45 ~0.60 2/3
Human expert ~0.95 ~0.90 ~0.85 ~0.90 3/3

The human-AI gap on task_hard is 0.40 points. Closing it requires genuine sequential reasoning, not pattern matching.

๐Ÿค– Agent Skill Taxonomy

The benchmark cleanly separates agents into four capability tiers:

Level Score Behavior
0 โ€” Random Walker 0.00โ€“0.15 Repeats same action, never declares RCA
1 โ€” Symptom Chaser 0.15โ€“0.40 Reads gateway logs, then diffuses across all services exhaustively
2 โ€” Structured Investigator 0.40โ€“0.70 Finds right service, applies wrong fix type or declares too late
3 โ€” Expert SRE 0.70โ€“1.00 3-step hypothesis, corroborating evidence, correct fix, time bonus

The gap between Level 2 and Level 3 is red herring resistance โ€” the most discriminative signal in this benchmark.


๐Ÿ“Š Getting Started with Baselines

The environment ships with inference.py, a reference baseline agent that uses chain-of-thought prompting.

Supported LLM Endpoints

The baseline works with any OpenAI-compatible endpoint. OpenAI (GPT-4o) is the recommended baseline.

๐ŸŒŸ Quick Start with OpenAI (Recommended)

Bash:

export API_BASE_URL="https://api.openai.com/v1"
export API_KEY="sk_YOUR_OPENAI_KEY"
export MODEL_NAME="gpt-4o"

python inference.py

PowerShell:

$env:API_BASE_URL="https://api.openai.com/v1"
$env:API_KEY="sk_YOUR_OPENAI_KEY"
$env:MODEL_NAME="gpt-4o"

python inference.py

Other Supported Providers

To use other providers, change the API_BASE_URL, API_KEY, and MODEL_NAME accordingly.

Provider Endpoint Model Example Setup
OpenAI โญ https://api.openai.com/v1 gpt-4o, gpt-4-turbo Get API key
Anthropic (Claude) Proxy via LiteLLM claude-3-opus Install LiteLLM
HuggingFace Inference https://api-inference.huggingface.co/v1 meta-llama/Llama-2-70b Get token
Together AI https://api.together.xyz/v1 mistralai/Mixtral-8x7B Get API key
Ollama (local) http://localhost:11434/v1 Any local model Install Ollama

๐Ÿ“ˆ Interpreting Results

Score Breakdown

Each task returns a score in [0.001, 0.999]. Higher is better. For correct RCA declarations, the final score is computed as:

score=clamp(0.001,base+evidence_bonus+efficiency_bonus,0.999)\text{score} = \text{clamp}(0.001, \text{base} + \text{evidence\_bonus} + \text{efficiency\_bonus}, 0.999)

Breaking it down:

Component Impact Notes
Base RCA Reward +0.50 Awarded for declaring correct RCA
Evidence Bonus 0 to +0.20 +0.05 per unique evidence type gathered (logs, metrics, health, queries); max 0.20
Efficiency Bonus 0 to +0.30 Reward for fast diagnosis: (max_steps - step_count) / max_steps ร— 0.30
Redundancy Penalty โˆ’0.08 or โˆ’0.20 Early repeats (before 50% steps): โˆ’0.08; Late repeats: โˆ’0.20
Wrong Interventions โˆ’0.30 Penalty for restarting/rolling back the wrong service
Wrong RCA โˆ’0.40 Penalty for declaring incorrect root cause

Examples:

Interpreting the Leaderboard

The leaderboard ranks agents by average score across all three tasks:

{
  "agent": "Qwen2.5-72B-Instruct",
  "scores": {
    "task_easy": 0.92,
    "task_medium": 0.68,
    "task_hard": 0.41
  },
  "average": 0.67,
  "solved": 2,  // tasks with score >= 0.70
  "rank": 5
}

Performance tiers:

Common Failure Patterns


๐Ÿ”— Integration and CI/CD

Embed the benchmark in GitHub Actions to test your agents automatically on every PR.

# .github/workflows/benchmark.yml
name: Benchmark Agent
on: [pull_request]
jobs:
  benchmark:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with: { python-version: '3.11' }
      - run: pip install -e .
      - env:
          API_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
          API_KEY: ${{ secrets.OPENAI_API_KEY }}
          MODEL_NAME: gpt-4o
        run: |
          uvicorn server.app:app --host 0.0.0.0 --port 7860 &
          sleep 3
          python inference.py > benchmark.json

๐Ÿš€ Quick Start & Benchmarking

1. Local Setup

Clone the repository and start the FastAPI + Gradio server:

Bash/PowerShell:

git clone https://github.com/Praneeth0910/incident-response-env
cd incident-response-env
pip install -e .
uvicorn server.app:app --host 0.0.0.0 --port 7860

Open http://localhost:7860/dashboard to play manually.

2. Docker (Production)

docker-compose up --build

See docker-compose.yml for port mappings.

3. Run the LLM Agent Baseline

Configure your environment variables and run inference.py.

Unix / Bash:

export API_BASE_URL="https://api.openai.com/v1"
export API_KEY="sk_YOUR_OPENAI_KEY"
export MODEL_NAME="gpt-4o"
python inference.py

Windows / PowerShell:

$env:API_BASE_URL="https://api.openai.com/v1"
$env:API_KEY="sk_YOUR_OPENAI_KEY"
$env:MODEL_NAME="gpt-4o"
python inference.py

4. Direct API Usage (Programmatic)

Send REST commands directly to evaluate custom agents without inference.py:

# Start an episode
curl -X POST http://localhost:7860/reset -H "Content-Type: application/json" -d '{"task_id": "task_easy"}'

# Take step
curl -X POST http://localhost:7860/step -H "Content-Type: application/json" -d '{"action_type": "read_logs", "target": "api-gateway"}'

# Get score
curl http://localhost:7860/grade

๐Ÿ—๏ธ Architecture

The environment is built with a modular domain-aware architecture supporting multiple incident types:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         User Interface (Gradio Dashboard)               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         FastAPI Server (port 7860)                      โ”‚
โ”‚  /reset, /step, /grade, /tasks, /state, /health        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      IncidentResponseEnv (State Machine)                โ”‚
โ”‚  Management, task dispatch, trajectory logging          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Reward System (Phase 4 โ€” Domain-Aware)                โ”‚
โ”‚  โ€ข Reward.py: Domain-dispatched reward functions        โ”‚
โ”‚  โ€ข EvidenceTracker: Multi-type evidence collection      โ”‚
โ”‚  โ€ข Support for: CI/CD, Kafka, Microservices             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Simulators (Phase 1-2 Extensions โ€” Experimental)      โ”‚
โ”‚  โ€ข cicd_simulator.py: GitHub Actions/GitLab CI          โ”‚
โ”‚  โ€ข kafka_simulator.py: Apache Kafka state machine       โ”‚
โ”‚  โ€ข Status: Integrated into reward.py, optional in env   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Current (Phase 1-5): Microservices incidents only.
Phase 1-2 simulators available via reward.py routing (see docs/ for roadmap).

๐Ÿ“ Repository Structure

incident-response-env/
โ”œโ”€โ”€ environment.py          # Core RL environment (primary)
โ”œโ”€โ”€ models.py               # Pydantic data models
โ”œโ”€โ”€ reward.py               # Domain-aware reward functions
โ”œโ”€โ”€ task_config.py          # Task ID registry
โ”œโ”€โ”€ inference.py            # Benchmark inference script
โ”œโ”€โ”€ benchmark_runner.py     # Full benchmark orchestration
โ”œโ”€โ”€ app.py                  # Gradio entry point
โ”œโ”€โ”€ start.sh                # Docker startup script
โ”‚
โ”œโ”€โ”€ server/
โ”‚   โ”œโ”€โ”€ app.py              # FastAPI application + REST endpoints
โ”‚   โ”œโ”€โ”€ dashboard_impl.py   # Gradio terminal dashboard
โ”‚   โ””โ”€โ”€ gradio_app.py       # Standalone Gradio launcher
โ”‚
โ”œโ”€โ”€ judge/
โ”‚   โ”œโ”€โ”€ llm_client.py       # LLM client (OpenAI / Anthropic / mock)
โ”‚   โ””โ”€โ”€ llm_judge.py        # Adversarial phase-aware judge
โ”‚
โ”œโ”€โ”€ simulators/
โ”‚   โ”œโ”€โ”€ cicd_simulator.py   # CI/CD pipeline state machine
โ”‚   โ””โ”€โ”€ kafka_simulator.py  # Kafka cluster state machine
โ”‚
โ”œโ”€โ”€ training/
โ”‚   โ”œโ”€โ”€ expert_agent.py     # Rule-based expert for SFT data generation
โ”‚   โ””โ”€โ”€ generate_data.py    # SFT dataset generator
โ”‚
โ”œโ”€โ”€ tasks/
โ”‚   โ”œโ”€โ”€ cicd_tasks.json     # CI/CD task definitions
โ”‚   โ””โ”€โ”€ kafka_tasks.json    # Kafka task definitions
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ AGENT.md            # Full agent operating manual
โ”‚   โ”œโ”€โ”€ ENVIRONMENT.md      # Complete environment specification
โ”‚   โ”œโ”€โ”€ BENCHMARK.md        # Multi-model benchmarking guide
โ”‚   โ”œโ”€โ”€ REWARDS.md          # Reward engineering deep dive
โ”‚   โ”œโ”€โ”€ SKILLS.md           # Agent capability taxonomy + prompt engineering
โ”‚   โ””โ”€โ”€ blog.md             # Technical blog โ€” SRE AI innovation story
โ”‚
โ”œโ”€โ”€ sft_data/               # Generated training trajectories
โ”œโ”€โ”€ test/                   # Integration tests
โ”œโ”€โ”€ tests/                  # Unit tests (pytest)
โ”œโ”€โ”€ Dockerfile              # Production container
โ”œโ”€โ”€ openenv.yaml            # OpenEnv specification manifest
โ””โ”€โ”€ README.md               # This file

๐Ÿ”Œ REST API

Endpoint Method Description
/health GET Liveness check
/reset POST Start a new episode ({"task_id": "task_easy"})
/step POST Execute one action
/grade GET Get final episode score [0.0, 1.0]
/state GET Ground truth state (debug only โ€” spoils the answer)
/tasks GET List all available tasks

Example session (Bash):

# Start episode
curl -X POST http://localhost:7860/reset \
  -H "Content-Type: application/json" \
  -d '{"task_id": "task_hard"}'

# Take action
curl -X POST http://localhost:7860/step \
  -H "Content-Type: application/json" \
  -d '{"action_type": "read_logs", "target": "redis-cache"}'

# Get score
curl http://localhost:7860/grade

Example session (PowerShell):

# Start episode
$body = @{task_id = "task_hard"} | ConvertTo-Json
Invoke-WebRequest -Uri "http://localhost:7860/reset" -Method POST -ContentType "application/json" -Body $body

# Take action
$body = @{action_type = "read_logs"; target = "redis-cache"} | ConvertTo-Json
Invoke-WebRequest -Uri "http://localhost:7860/step" -Method POST -ContentType "application/json" -Body $body

# Get score
Invoke-WebRequest http://localhost:7860/grade

Real-World Impact

Who benefits from solving this benchmark?

The global Site Reliability Engineering market is valued at $8.7 billion (2024) and growing at 15% CAGR. Every percentage point improvement in automated incident resolution translates directly to engineering hours saved and service reliability improved.


๐Ÿ“š Documentation

Document Description
AGENT.md Complete agent operating manual โ€” optimal strategies, anti-patterns, example episodes
ENVIRONMENT.md Full API reference, task definitions, extending the environment
BENCHMARK.md Multi-model benchmarking, supported endpoints, result interpretation
REWARDS.md Reward engineering philosophy, tuning guide, RL training tips
SKILLS.md Agent skill taxonomy, prompt engineering recommendations

๐Ÿค Contributing

Want to add new fault types, tasks, or services? See ENVIRONMENT.md for the extension guide.

Pull requests welcome for:


๐Ÿ“„ License

Apache 2.0 โ€” free for research, commercial use, and derivative works.


Built for the OpenEnv ร— Scaler Hackathon 2026

Making AI reliable enough to be your on-call engineer.