HF RL Explorer

Implement a command-line tool at /app/ratelimit.py that enforces a hybrid token-bucket plus sliding-window…

Implement a command-line tool at /app/ratelimit.py that enforces a hybrid token-bucket plus sliding-window…: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). The tool reads JSON events from stdin (one JSON object per line), one per second (simulated), and writes…

The task

The tool reads JSON events from stdin (one JSON object per line), one per second (simulated), and writes JSON decisions to stdout (one per line). It must track usage per `user_id` and per `endpoint`, applying both a token bucket and a sliding window limit simultaneously. An event is ALLOWED only if it passes BOTH the…

Part of ai-and/termgrade-environments.