gateOpen source (MIT)

Make agents wait their turn instead of getting refused.

Type
Project
Role
Open source
Category
Developer tools
Started
Sep 2026
Status
Open source (MIT)
92tests
40 of 40requests answered with the gate stopped

The problem

Agents and batch jobs burst requests at shared services faster than those services can take them. Rejecting the extra calls just makes every caller retry.

The approach

The gate sits behind the reverse proxy, in front of each service, and paces the traffic. Callers wait for a slot instead of being turned away, one caller cannot starve the rest, and an identical write resent within a minute is answered once. Clients change nothing: same hostname, same credentials, and one extra header naming the cell that paced them. If the gate itself dies, the proxy sends traffic straight to the service.

My part

I built it from September 2026 and published it as open source on 26 October 2026, under the MIT licence. It runs as edge functions and durable actors on my own hardware. Each service and each caller gets its own reserve-ahead token bucket, and a request waits up to 30 seconds before it gets a 503 with Retry-After. State lives in memory and one alarm per actor flushes it every 10 seconds, which cut durable writes from 6.08 per request to 0.20. With the gate stopped, 40 of 40 requests were still answered directly. Fair sharing across many moderate callers is not built yet.

How the pieces connect

  1. Reverse proxy
  2. Caller’s own bucket
  3. Service’s shared bucket
  4. Forward, or answer the repeat once

Built with

  • TypeScript
  • Edge functions
  • Durable actors

Questions about gate?

I’m glad to talk about how it works and what I learned building it.

Next projectClaudeDeckSee every Claude Code session at a glance.
⌃