You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exam generation tool is likely to be one of the most expensive features in Twiga, since it will consume many tokens per request. Because of that, we should not leave it unlimited from day one. A simple daily limit helps control cost and prevents abuse while we learn how teachers actually use the feature.
Background
You can assume the exam generation tool is already available. The need here is just to add a usage cap per user, for example allowing each teacher to generate exams up to 5 times per day.
Goal
Add a daily rate limit for the exam generation tool on a per-user basis. A good first limit could be 5 generated exams in a 7-day window.
Plan
The implementation should be simple, but might need a DB migration. Before the tool runs, Twiga should check how many times that user has already used exam generation during the current day. If the limit has been reached, the tool should not run and the user should receive a clear message explaining that they have reached the daily limit. If not, the request should continue normally and the usage should be recorded.
Activity
linear commentedon Mar 28, 2026
TW-121