Lesson 13.09 · Phase 13 · Production Agents

Rate limits & backpressure

You can't go faster than your provider's limits. You can stop wasting calls hitting them, and you can tell your own callers "not now" while that's still a useful answer.

Learning objectives

  • Model a provider's requests-per-minute and tokens-per-minute limits as token buckets, and read 429 + Retry-After.
  • Compare four client strategies on one burst: naive retries, per-request backoff, a client-side token bucket, and adaptive (AIMD) concurrency.
  • Explain why no client strategy finishes sooner than the limits allow, and what each one saves instead.
  • Put a bounded queue in front of the agent and shed load early, so accepted requests wait seconds instead of minutes.

A customer imports 300 support tickets, and your agent makes a model call for each. Your provider allows 60 requests and 40,000 tokens a minute. The first minute goes fine. Then every call comes back 429 Too Many Requests, your loop retries immediately, and the retries are also 429s.

Loading the full lesson…