tukaram12/RL-task-manager
0
Grid-based RL Mini-Game Environment
Project Description
This is a comprehensive, production-ready reinforcement learning environment designed for Hugging Face Spaces. It strictly follows OpenEnv API standards. The game challenges an agent to navigate a 10x10 grid from a starting point (top-left) to a goal point (bottom-right) while avoiding traps and collecting optional rewards.
API Endpoints (FastAPI)
The environment provides the standard RL endpoints via FastAPI:
POST /resetReturns:{"observation": <Observation>}POST /stepExpects Body:{"direction": "<up|down|left|right>"}Returns:{"observation": <Observation>, "reward": <float>, "done": <bool>}GET /stateReturns:<Observation>
Observation and Action Spaces
Observation (Pydantic Model)
agent_position: Tuple[int, int]goal_position: Tuple[int, int]grid_size: intsteps_taken: int
Action (Pydantic Model)
direction: Literal string containing either"up","down","left", or"right".
Reward Logic
- Base turn penalty:
-1.0(encourages taking the shortest path) - Reaching the goal:
+10.0 - Hitting a trap:
-5.0 - Collecting a reward cell:
+3.0
Graders & Difficulties
The environment specifies three difficulty tasks:
- Easy: Just reach the goal.
- Medium: Reach the goal efficiently with fewer steps.
- Hard: Reach the goal under a strict, unforgiving step-limit.
Instructions to Run Locally
- Install dependencies:
pip install -r requirements.txt- Start the OpenEnv FastAPI Server:
uvicorn app:app --host 127.0.0.1 --port 7860- Run the Streamlit UI (in a new terminal window):
streamlit run streamlit_app.py- Evaluate the baseline agent:
python inference.pyDeploying to Hugging Face Spaces
This project includes a standard Dockerfile setup for Docker runtime SDK on Hugging Face Spaces. Simply push the repository to a space with SDK set to Docker, and the API will be exposed on port 7860 automatically.
