ichi-goat7/cloud-kitchen-env
๐ณ Cloud Kitchen Scheduling Environment (OpenEnv)
๐ Overview
This project implements a real-world reinforcement learning environment simulating a cloud kitchen operation.
An AI agent must intelligently schedule incoming food orders to limited cooking slots (stoves), while managing:
- โฑ๏ธ Cooking time
- ๐ฆ Order deadlines
- ๐ฅ Limited kitchen resources
- ๐ฐ Revenue optimization
The goal is to maximize total reward by completing high-value orders on time while avoiding inefficiencies.
๐ง Environment Design
The environment follows a standard OpenEnv-style API implemented as a FastAPI app.
Core Endpoints
POST /resetโ Initializes the environment and returns the initial observationPOST /stepโ Executes an agent action and returns observation, reward, done, infoGET /stateโ Returns the current environment stateGET /โ Health check (returns "Cloud Kitchen Env running ๐")
Core Methods (Backend)
reset()โ Initializes environmentstep(action)โ Executes agent actionstate()โ Returns current observation
๐ Base URL
https://ichi-goat7-cloud-kitchen-env.hf.space
๐ 1. Reset Environment
Endpoint
POST /reset
Description
Resets the environment to the initial state.
Request
No body required.
Example (PowerShell)
Invoke-RestMethod -Uri "https://ichi-goat7-cloud-kitchen-env.hf.space/reset" -Method POST
Example (curl)
curl -X POST https://ichi-goat7-cloud-kitchen-env.hf.space/reset
Response
{ "current_time": 0, "orders": [...], "slots": [...] }
โก 2. Take a Step
Endpoint
POST /step
Description
Executes one environment step using the provided action.
Request Payload
{ "assignments": [ { "slotid": 1, "orderid": 1 } ] }
Example (PowerShell)
Invoke-RestMethod -Uri "https://ichi-goat7-cloud-kitchen-env.hf.space/step" -Method POST -Body '{"assignments":[{"slot_id":1,"order_id":1}]}' -ContentType "application/json"
Example (curl)
curl -X POST https://ichi-goat7-cloud-kitchen-env.hf.space/step \ -H "Content-Type: application/json" \ -d '{"assignments":[{"slotid":1,"orderid":1}]}'
Response
{ "observation": { "current_time": 1, "orders": [...], "slots": [...] }, "reward": 0.0, "done": false, "info": { "events": [] } }
๐ 3. Get Current State
Endpoint
GET /state
Description
Returns the current environment state without modifying it.
Example (PowerShell)
Invoke-RestMethod ` -Uri "https://ichi-goat7-cloud-kitchen-env.hf.space/state"
Example (curl)
curl https://ichi-goat7-cloud-kitchen-env.hf.space/state
Response
{ "current_time": 0, "orders": [...], "slots": [...] }
โ Action Format Summary
{ "assignments": [ { "slotid": int, "orderid": int } ] }
๐ Example Workflow
- POST /reset
- POST /step (assign orders)
- Repeat
/stepuntil"done": true
๐ฅ Observation Space
Each step returns:
current_timeโ Current timestepordersโ List of pending ordersslotsโ Current cooking slot status
๐ฎ Action Space
The agent provides assignments of order_id โ slot_id
Example
Action(assignments=[
Assignment(slot_id=1, order_id=2)
])๐ Design Note
Initially, the environment supported explicit manual assignment of orders to slots.
In the current version, the baseline agent automates this process using a scheduling strategy:
- When a slot becomes free, the agent automatically selects an order
- Orders are chosen based on Earliest Deadline First (EDF)
๐ This reflects a more realistic system where decisions are made dynamically rather than manually.
๐ฏ Motivation
Unlike toy problems or games, this environment models a real operational challenge faced by cloud kitchens:
"How do you prioritize and schedule orders when resources are limited and deadlines matter?"
This introduces real-world complexities like:
- Trade-offs between speed vs value
- Resource contention (limited slots)
- Time-sensitive decision making
๐ Reward Function
The reward system reflects operational efficiency:
โ Positive Rewards
- Full reward โ Order completed before deadline
- Partial reward โ Order completed slightly late
โ Penalties
- Late completion โ Reduced or negative reward
- Idle cooking slot โ Penalty (unused resource)
๐ This encourages the agent to keep slots busy and prioritize timely deliveries
๐ Tasks & Difficulty Levels
We define 3 tasks with increasing difficulty:
Interpretation
- Agent performs well in simple settings
- Performance drops under constraints
- Demonstrates increasing task complexity
โ Key Features
- โ Real-world task (cloud kitchen scheduling)
- โ OpenEnv-compatible API
- โ Typed models using Pydantic
- โ Multi-task evaluation system
- โ Continuous reward shaping
- โ Reproducible baseline results
- โ Dockerized for deployment
โ๏ธ Setup Instructions
1. Clone Repository
git clone https://github.com/KumoDrift/CLoudKitchenEnv-pytorch-hackathon
cd cloud-kitchen-env2. Install Dependencies
pip install -r requirements.txtโถ๏ธ Run Inference
python inference.py๐ณ Docker Support
Build and run:
docker build -t cloud-kitchen-env .
docker run -p 7860:7860 cloud-kitchen-env๐จโ๐ป Author
KumoDrift Cloud Kitchen RL Environment Project
