Cutting GitHub rate-limit use 75% in an agent PR watcher
- Source
- x.com
- Publisher
- Theo Browne
- Date
I have spent far too much time on the Github integrations in T3 Code the last few days. Cut rate limit usage by over 75% and made monitoring behaviors much more reliable. Julius moved us off the CLI for API calls we can do more efficiently directly. We rotate between the GQL and rest APIs depending on which uses your rate limits most efficiently (with fallbacks). This was a ton of work that will largely go unnoticed, but it's the type of stuff I love. Had to do like 30 implementations of the PR watcher before I got it to a good spot. On one hand, I'm thankful the details can be seen by those who dig into the source code. On the other, feels weird that everyone else will just copy our work and never have to think so much about this.
Context
Theo says a few days of work on the GitHub integrations in T3 Code, the coding-agent app Theo's team ships, cut their use of GitHub's rate limits by more than 75% and made monitoring behaviors "much more reliable." The October 7 post names two changes. Julius "moved us off the CLI for calls we can do more efficiently directly," and the integrations now rotate between GitHub's GraphQL and REST APIs depending on which uses "your rate limits" most efficiently, with fallbacks.
A rate limit is a cap on how many requests an account or may send to an API in a given period. Once it is spent, further requests fail until the allowance resets, so a that keeps checking pull requests in the background can run out and stop seeing changes. GitHub offers two interfaces to much of the same data: REST, where each request fetches a fixed resource, and GraphQL, where one query names exactly the fields it wants. The two are metered differently, so which one is cheaper depends on the request, and the post describes switching between them based on which is cheaper, rather than committing to one. The post does not say why the direct calls beat the CLI, which requests changed, or how the 75% was measured, so the figure is Theo's account of this integration work, not a general saving from switching APIs.
The post singles out the PR watcher, the piece that keeps track of a pull request: Theo says it took "like 30 implementations" before it reached a good spot. About two hours later, a second post from Theo said Theo's agents had written over 200 bad "watch pr" scripts over the previous few months, and it shared a for auditing agent history for reinvented PR-babysitting logic. Read together, the two posts suggest why Theo spent so long on it: getting a PR watcher right took dozens of attempts, and agents left to improvise one kept producing flawed versions.
Theo expects the work to go largely unnoticed by users and notes that the details are visible to anyone who digs into T3 Code's source code, with the mixed feeling that others will copy it without having to think the problem through.
- API — Application programming interface: the agreed set of operations, inputs and outputs through which one piece of software uses another.
- Token — A piece of text, such as a word, part of a word or a punctuation mark, that a language model represents as numbers and handles as a unit.
- Tool — An operation that the software around a model makes available for the model to request, with a name, expected inputs and a kind of result.
- Prompt — Information or instructions supplied to a model; in a chat, the request you type is often called your prompt.
