| title | NetArena SRE |
|---|---|
| emoji | π§ |
| colorFrom | red |
| colorTo | gray |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
Companies lose an average of $300,000 per hour of unplanned downtime. NetArena puts an AI agent on-call β testing whether it can diagnose and resolve production outages faster and more reliably than a human SRE. No guesswork, no LLM judges: every score is mathematically determined by a deterministic state machine.
NetArena is a sandboxed SRE (Site Reliability Engineering) Incident Response Simulator built for the OpenEnv / Meta PyTorch Hackathon. An AI agent is dropped into a simulated Linux terminal and tasked with resolving 3 production outages of escalating difficulty β from a downed web server to a full disk + crashed database.
Key properties:
- Zero real system calls. All commands (
systemctl,kill,df,rm, etc.) are intercepted by a Python dictionary-based state machine β the environment is completely safe and reproducible. - Deterministic scoring. Rewards are computed from final system state, not LLM opinion. Every run is mathematically verifiable.
- OpenEnv-compliant. Structured JSON stdout logging (
[START],[STEP],[END]) makes evaluation fully automated.
inference.py main.py environment.py graders.py
(LLM client) β (FastAPI :7860) β (state machine) β (scoring)
| Component | Responsibility |
|---|---|
inference.py |
Calls the LLM, extracts JSON commands, POSTs to FastAPI, feeds observations back in a loop |
main.py |
Exposes REST API (/reset, /step, /state, /health) on port 7860 |
environment.py |
SREEnvironment β tracks per-task SystemState, dispatches string commands to handlers |
graders.py |
Reads final SystemState and returns a deterministic Reward (0.0 β 1.0) |
models.py |
Pydantic schemas: Action, Observation, Reward, SystemState |
prompts.py |
System prompt enforcing JSON-only LLM output with Chain-of-Thought |
No real Linux commands ever execute. The
_dispatch()method inenvironment.pypattern-matches command strings and mutates a Python dictionary β making the environment portable, safe, and perfectly reproducible across any machine.
| # | Task ID | Difficulty | Scenario | Success Condition | Max Steps |
|---|---|---|---|---|---|
| 1 | task1 |
Easy | Nginx web server is inactive |
nginx_status == "running" |
15 |
| 2 | task2 |
Medium | Port 8080 blocked by a zombie process | Zombie PID killed + port_8080_free == true |
15 |
| 3 | task3 |
Hard | Disk at 100% + PostgreSQL crashed | disk_usage_percent < 90 + db_status == "running" |
15 |
Task 1 β Service Down (Easy)
The Nginx web server has stopped. The agent must inspect service status, identify that Nginx is inactive, and issue the correct restart command. A single, well-reasoned command chain solves it.
Task 2 β Port Conflict (Medium)
Port 8080 is held hostage by a zombie process. The agent must list running processes or check lsof/ss to find the offending PID, kill it, and confirm the port is clear before the application can rebind.
Task 3 β Disk Full and DB Crash (Hard) The disk is at 100% capacity, which has caused PostgreSQL to crash. The agent must locate the oversized log file (typically several GB), truncate or delete it to free disk space, then restart the database. Both conditions must be resolved for full credit β partial fixes earn partial credit.
- Python 3.11+
- An OpenAI-compatible LLM endpoint + API token
git clone https://github.com/Muzaffar-codes07/NetArena.git
cd NetArena
pip install -r requirements.txtuvicorn main:app --host 0.0.0.0 --port 7860The FastAPI server is now live at http://localhost:7860. Swagger docs available at http://localhost:7860/docs.
Set the required environment variables and launch the inference loop:
export API_BASE_URL=http://localhost:7860
export MODEL_NAME=<your-model-name> # e.g. meta-llama/Llama-3-8b-instruct
export HF_TOKEN=<your-huggingface-token>
python inference.pyThe agent will iterate through all 3 tasks, printing structured JSON logs to stdout for each step.
# Build the image
docker build -t netarena .
# Run the container
docker run -p 7860:7860 netarenaThe container starts the FastAPI server on port 7860 β matching the Hugging Face Spaces app_port requirement.
All endpoints accept and return JSON.
Health check. Returns {"status": "ok"}.
Initialises a task and returns the opening alert.
Query params: task_id β one of task1, task2, task3
Response:
{
"stdout": "ALERT: Nginx is not responding. Customers are seeing 502 errors."
}Executes one agent action. Returns the simulated terminal output, current reward, and done flag.
Query params: task_id β must match a previously reset task
Request body:
{
"command": "systemctl status nginx",
"explanation": "Check why Nginx is not responding."
}Response:
{
"observation": {
"stdout": "β nginx.service - A high performance web server\n Loaded: loaded\n Active: inactive (dead)",
"stderr": "",
"exit_code": 3,
"step_number": 1,
"done": false
},
"reward": {
"value": 0.1,
"reason": "Diagnostic investigation started."
},
"done": false
}Returns the full internal SystemState for a task. Useful for debugging.
Rewards are computed deterministically from SystemState in graders.py:
| Event | Reward | Condition |
|---|---|---|
| Diagnostic started | +0.1 | Any diagnostic command run |
| Partial fix (Task 3 only) | +0.3 | Disk freed or DB restarted (not both) |
| Full resolution | +1.0 | All success conditions met |
Rewards are non-cumulative per grading call β the grader returns the highest applicable reward at each step to avoid double-counting.
inference.py emits structured JSON to stdout for automated judging:
| Model | Task 1 Score | Task 2 Score | Task 3 Score | Total |
|---|---|---|---|---|
| (TBD) | β | β | β | β |
| (TBD) | β | β | β | β |
| (TBD) | β | β | β | β |
Fill in before final submission with model name and achieved scores.
NetArena/
βββ main.py # FastAPI server β entry point for the environment
βββ environment.py # SREEnvironment state machine + command dispatcher
βββ graders.py # Deterministic reward functions per task
βββ inference.py # LLM agent loop + OpenEnv-compliant logging
βββ models.py # Pydantic data models
βββ prompts.py # System prompt (JSON-only, Chain-of-Thought)
βββ openenv.yaml # Task metadata for the OpenEnv competition
βββ requirements.txt # Python dependencies
βββ Dockerfile # Container definition for HF Spaces deployment
OpenEnv / Meta PyTorch Hackathon β a competition to build robust, evaluatable AI agent environments with deterministic, bias-free scoring.