Challenge - 5 Problems
Rate Limiting & Budget Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 conceptual
intermediate1:30remaining
Understanding Rate Limiting Purpose
Why is rate limiting important in managing AI agent requests?
Attempts:
2 left
❓ model choice
intermediate1:30remaining
Choosing a Budget Control Strategy
You want to limit the total compute cost of AI agent calls over a month. Which budget control method is best?
Attempts:
2 left
💻 code output
advanced2:00remaining
Output of Rate Limiting Code Snippet
What is the output of this Python code simulating a simple rate limiter?
Agentic_ai
import time class RateLimiter: def __init__(self, max_calls, period): self.max_calls = max_calls self.period = period self.calls = [] def allow(self): current = time.time() self.calls = [call for call in self.calls if call > current - self.period] if len(self.calls) < self.max_calls: self.calls.append(current) return True return False limiter = RateLimiter(3, 5) results = [] for _ in range(5): results.append(limiter.allow()) time.sleep(1) print(results)
Attempts:
2 left
❓ metrics
advanced1:30remaining
Interpreting Budget Control Metrics
You have a budget control system that tracks 'calls_used' and 'calls_remaining'. If calls_used = 750 and calls_remaining = 250, what is the total budget and percentage used?
Attempts:
2 left
🔧 debug
expert2:00remaining
Debugging Budget Control Logic
Given this budget control snippet, what error will occur when running it?
Agentic_ai
class BudgetControl: def __init__(self, max_calls): self.max_calls = max_calls self.calls_made = 0 def make_call(self): if self.calls_made < self.max_calls: self.calls_made += 1 return True else: return False budget = BudgetControl(3) results = [budget.make_call() for _ in range(5)] print(results) print(budget.calls_remaining)
Attempts:
2 left
