Skip to content

Add rate-limiter package - #7

Merged
ThomasHartDev merged 1 commit into
mainfrom
thomas/feat/rate-limiter
Jul 20, 2026
Merged

Add rate-limiter package#7
ThomasHartDev merged 1 commit into
mainfrom
thomas/feat/rate-limiter

Conversation

@ThomasHartDev

Copy link
Copy Markdown
Owner

adds a packages/rate-limiter with three primitives for throttling calls to a model provider: a token bucket for smoothing bursts with continuous refill, a sliding-window log that stays exact at the window edge instead of letting 2x through across a boundary, and a FIFO concurrency semaphore for capping in-flight work. all three take an injectable clock so the refill, burst, and concurrency behavior is deterministic in tests rather than leaning on real timers. covers the edge cases too, backward clocks, over-release, multi-unit costs. next step is wiring the bucket into the llm provider so a runaway agent can't blow a per-minute quota.

@ThomasHartDev
ThomasHartDev merged commit 2037be4 into main Jul 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant