🖥️ Junior DevOps Environment
A stateful simulation of a production Linux server where AI agents practice DevOps tasks.
What Is This?
A stateful simulation of a production Linux server. An AI agent interacts with it
using shell-like commands (cat, grep, ps, kill, sed, restart, …) to
complete progressively harder system administration tasks.
The environment implements the OpenEnv API contract :
Method Endpoint Description reset()POST /resetInitialize/reset the environment step()POST /stepExecute one action, get observation + reward state()GET /stateRead the full current state
Task Difficulties
🟢 Easy — Find the Error Code
The app is crashing. Locate the error code buried in /var/log/app.log.
Optimal solution:
1 cat /var/log/app.log
2 grep ERROR /var/log/app.log
3 echo ERR_502
Reward: 0.4 for opening the file · 1.0 for reporting the code
🟡 Medium — Kill the CPU Hog
A rogue process is consuming 90%+ CPU and grinding the server to a halt.
Optimal solution:
Reward: 0.3 for inspecting processes · 1.0 for killing the rogue process
🔴 Hard — Fix the Port Conflict
nginx is failed because its config listens on port 5432 (PostgreSQL's port).
Fix it and restart nginx.
Optimal solution:
1 cat /etc/nginx/nginx.conf
2 sed 5432 8080 /etc/nginx/nginx.conf
3 restart nginx
Reward: 0.2 read · 0.4 identified · 0.7 fixed · 1.0 restarted
Setup and Installation
Prerequisites
Python 3.8+
Docker (optional, for containerized deployment)
Local Development
Clone the repository:
1 git clone https://github.com/akshat2805p/Junior-DevOps.git
2 cd Junior-DevOps
Install dependencies:
pip install -r requirements.txt
Run the server:
The server will start on http://localhost:7860.
Docker Deployment
Build and run with Docker:
1 docker build -t junior-devops .
2 docker run -p 7860 :7860 junior-devops
API Usage
1. Reset the Environment
1 curl -X POST http://localhost:7860/reset \
2 -H "Content-Type: application/json" \
3 -d '{"difficulty": "hard", "seed": 42}'
2. Take an Action
1 curl -X POST http://localhost:7860/step \
2 -H "Content-Type: application/json" \
3 -d '{"action": "cat /etc/nginx/nginx.conf"}'
Response:
1 {
2 "observation" : "worker_processes auto;\nevents { worker_connections 1024; }\nhttp {\n listen 5432;\n ..." ,
3 "reward" : 0.2 ,
4 "done" : false ,
5 "info" : {
6 "step" : 1 ,
7 "checkpoints" : {
8 "read_config" : true ,
9 "identified_conflict" : false ,
10 "fixed_config" : false ,
11 "restarted_nginx" : false
12 }
13 }
14 }
3. Read Current State
curl http://localhost:7860/state
Running the AI Agent
1 # Install dependencies
2 pip install -r requirements.txt
3
4 # Solve easy task
5 python agent.py --difficulty easy --env-url http://localhost:7860
6
7 # Train via REINFORCE for 100 episodes
8 python agent.py --train --difficulty hard --episodes 100
Architecture
┌─────────────────────────────────────┐
│ DevOps Agent (PyTorch) │
│ ┌─────────────┐ ┌──────────────┐ │
│ │ Observation │ │ Policy │ │
│ │ Encoder │→ │ Network │ │
│ │ (8-dim) │ │ (MLP 8→64 │ │
│ └─────────────┘ │ →64→13) │ │
│ └──────┬───────┘ │
│ action_idx │ │
│ ┌──────▼───────┐ │
│ │ LLM Filler │ │
│ │ (heuristic) │ │
│ └──────┬───────┘ │
└──────────────────────────┼──────────┘
action │ (shell cmd)
┌───────▼──────────┐
│ JuniorDevOpsEnv │
│ FastAPI Server │
│ POST /step │
└──────────────────┘
Grading
Checkpoint Easy Medium Hard Step 1 +0.4 +0.30 +0.20 Step 2 +0.6 +0.30 +0.20 Step 3 — +0.40 +0.30 Step 4 — — +0.30
Rewards are cumulative and partial — no binary 0/1 scoring.
Contributing
Feel free to open issues or submit pull requests for improvements.
License
MIT License