KestrelDocs

Runs

Set how fast each repo may start runs and spend. Bursts above the limit are turned away at the edge, before they cost anything.

Fig. 1Rate limiting
Rate limiting float rate(float x) { float P = 420.0; float b = 0.0; for (int j = -1; j <= 3; j++) b += exp(-pow(x - 420.0 - float(j) * P, 2.0) / 2116.0); return 70.0 + 36.0 * sin(TAU * 3.0 * x / P + 0.3) + 24.0 * sin(TAU * 7.0 * x / P + 1.0) + 190.0 * b; } float field(vec2 p, float t) { float X0 = 60.0, X1 = 655.0, FLOOR = 400.0, LIM = 220.0; if (p.x < X0 || p.x > X1 || p.y > FLOOR) return 0.0; float xx = p.x + 420.0 * t / T; float top = FLOOR - rate(xx); if (p.y < top) return 0.0; if (p.y >= LIM) { float flare = top < LIM ? 0.45 * exp(-pow(p.y - LIM, 2.0) / 50.0) : 0.0; return 0.42 + 0.5 * (p.y - max(top, LIM)) / (FLOOR - max(top, LIM)) + flare; } // above the limit: sheared off, breaking into spray that rises and fades. It moves 60 columns and 30 cells a cycle, // and its pattern repeats over exactly those, so the loop closes. float rise = (LIM - p.y) / (LIM - top + 1.0); float spray = step(0.6, hash(vec2(mod(floor(xx / 7.0), 60.0), mod(floor((p.y + 9.4 * 30.0 * t / T) / 9.4), 30.0)))); return spray * (0.55 - 0.42 * rise); }
Requests arrive in a burst. The ones within the limit pass through at a steady pace; the rest are turned away at the edge and told when to try again.

Set a limit

Limits live in kestrel.yaml, so they are reviewed like any other change to the repo.

kestrel.yaml
limits:
  runs_per_minute: 20
  spend_per_day: 50     # dollars
LimitWhat happens when it is reached
runs_per_minuteNew runs are refused with 429 and a Retry-After header
spend_per_dayNew runs wait in the queue until the next day

What a refused run looks like

HTTP
HTTP/1.1 429 Too Many Requests
Retry-After: 18
Content-Type: application/json

{ "error": { "type": "rate_limited", "message": "acme/web-app may start 20 runs a minute", "retry_after": 18 } }

The SDKs read Retry-After and wait before trying again, up to maxRetries times. See Retries.

Workspace limits

Every workspace also has a ceiling of 600 API requests a minute, across all keys. It is there to stop a loop in a script from flooding the API, and few teams ever reach it.

Tip

Give a noisy repo its own low spend_per_day. It can then never use up the whole team's monthly cap.

Was this page helpful?

Open the dashboard