Design a rate limiter that controls the billing tokens AI agents consume. Two L5 onsite reports name it: one calls it a variant of the classic rate limiter and answered with a token bucket (that loop passed); the other says the tokens are output tokens, so you must handle the last request when there are not enough tokens left, and that nothing else about the round was special. No report gives scale, other follow-ups, or how the last-request question was answered.
Naive approach with serious trade-off — being authored.
Solid baseline with reasonable trade-offs — being authored.
Production-grade approach with explicit trade-off rationale — being authored.
Cover happy path. Clarify scope. Identify the obvious bottleneck. Pick a reasonable storage and reasonable scaling approach.
All of the above plus: explicit failure handling, durability vs latency trade-offs, choose the right batching/caching strategy, articulate why.
All of the above plus: organizational concerns (rollout, migration, on-call), quantitative analysis, multi-region considerations, what could go wrong with the proposed solution at 10x scale.
Interviewer hints: One report says the limit is on output tokens, so you have to handle the last request when the bucket cannot cover it; it says nothing else about the round was special. The other names only the prompt and that it answered with a token bucket. No other interviewer probe is reported.
Edge cases to test (ours): a request whose output is larger than what is left; several requests from one agent in flight at once; a long idle gap (refill must stop at capacity); output size only known after generation.
Alternative approaches (ours): Leaky bucket (smooths traffic to a constant rate; less burst-tolerant, and a poor fit for requests whose size varies by thousands of tokens); Fixed window counter (simple; allows up to twice the rate at window edges); Sliding window log (exact, but stores every event; heavy at high request rates)
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 48 Google questions, refreshed monthly from new candidate reports.