CoolFace
Apppublic

1Jayanth/devops-autoheal1

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

๐Ÿค– DevOps AI Simulator (v5.2.0-STABLE)

A production-grade, OpenEnv-compliant reinforcement learning environment and interactive platform for building, evaluating, and visualizing AI agents specialized in SRE (Site Reliability Engineering) and Auto-Healing.

This project simulates real-world DevOps system failures, providing a rich training ground for AI agents to diagnose and resolve incidents including memory leaks, database locks, and CPU scaling bottlenecks.


๐Ÿš€ Quick Start

Ensure you have uv installed.

1. Start the Environment Server (FastAPI)

bash
uv run uvicorn server.app:app

Port 8000 (standard for OpenEnv).

2. Launch the Interactive Dashboard (Streamlit)

bash
uv run streamlit run streamlit_app.py

Accessible at [http://localhost:8501](http://localhost:8501).

3. Run AI Agent Inference (CLI)

bash
# Requires GROQ_API_KEY or OpenAI-compatible endpoint
uv run python3 inference.py

๐Ÿ—๏ธ Technical Architecture

The platform is built on the openenv-core SDK and utilizes a Dual-State Model:

  1. 1.Observable State: CPU (%), Memory (%), DB Latency, and Service Status (API/DB/Cache).
  2. 2.Hidden Root Causes: Memory leaks, database locks, and CPU scaling bottlenecks.

๐Ÿ” Simulation Engine

  • โ€”Failure Propagation: Metrics evolve dynamically based on hidden failures. A memory leak (memory > 85%) increases the objective chance of a service crash.
  • โ€”Multi-Step Chains: Resolving 'Expert' tasks requires specific action sequences (e.g., investigating logs โ†’ clearing cache โ†’ restarting the API).
  • โ€”Log Generator: A 3-depth log system that only reveals the true 'Root Cause' message after the agent executes check_logs.

๐Ÿ“Š Environment Specification

๐ŸŽฎ Available Actions

  • โ€”restart_service:[api|database|cache]
  • โ€”scale_up:cpu
  • โ€”optimize_database
  • โ€”clear_cache
  • โ€”check_logs
  • โ€”do_nothing (only valid when system is healthy)

๐Ÿ“ˆ Scoring & Rewards

Episodes are graded out of 1.0 via a deterministic 5-component scoring model:

  • โ€”Outcome (35%): Reaching a 'healthy' status.
  • โ€”Logic Match (25%): Using the correct corrective action for the specific hidden cause.
  • โ€”Efficiency (15%): Minimizing unnecessary steps.
  • โ€”Health Bonus (15%): Maximizing resource optimization.
  • โ€”Diagnostic (10%): Rewarding log investigation before fixing.

๐Ÿค– AI Agent Integration

The project includes a production-grade inference engine (inference.py) that supports:

  • โ€”Groq (LLaMA-3): Blazing-fast inference for real-time SRE responses.
  • โ€”Reasoning Protocol: The agent identifies the root_cause, cites evidence_logs, and proposes a plan before taking an action.
  • โ€”Safety Fallbacks: Hardcoded SRE heuristics protect the system if the LLM fails or hallucinations are detected.

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ env/                   # Core Logic
โ”‚   โ”œโ”€โ”€ environment.py     # Rewards, State Transitions, Failures
โ”‚   โ”œโ”€โ”€ tasks.py           # Dynamic Scenario Generation
โ”‚   โ””โ”€โ”€ models.py          # Pydantic Schemas
โ”œโ”€โ”€ server/
โ”‚   โ””โ”€โ”€ app.py             # FastAPI Endpoints (/reset, /step, /auto-run)
โ”œโ”€โ”€ streamlit_app.py       # Interactive Web UI
โ”œโ”€โ”€ inference.py           # AI Agent & Reasoning Engine
โ”œโ”€โ”€ openenv.yaml           # Manifest for Hugging Face Deployment
โ””โ”€โ”€ requirements.txt       # Dependencies

โ˜๏ธ Deploying to Hugging Face Spaces

This environment is optimized for deployment as a Docker Space:

bash
# Register the environment and push to HF
openenv push

The deployed space includes:

  • โ€”Interactive UI at /web
  • โ€”FastAPI Documentation at /docs
  • โ€”OpenEnv Specification at /spec

๐Ÿ“„ License

MIT License. Created for the OpenEnv DevOps/SRE Auto-Healing Benchmark.