answered from live GitHub & Hugging Face data
What are the best practices for managing rate limits when using multiple AI coding agents like Claude Code and Codex in the same GitHub repository?
Give each agent its own GitHub App installation, not a shared personal access token. A personal access token draws from one 5,000-request-per-hour budget, so two agents using it compete for the same quota. An app installation has its own budget, and the limit grows with the size of the installation.
Why the budget matters
| Authentication | Primary limit (per hour) | Shared with | Source |
|---|---|---|---|
| Personal access token | 5,000 | Every token, app, and OAuth grant of that user | REST rate limits |
| GitHub App installation token | 5,000 minimum, up to 12,500 | Only that installation | REST rate limits |
| GitHub App, Enterprise Cloud org | 15,000 | Only that installation | REST rate limits |
GITHUB_TOKEN in Actions |
1,000 per repository | The repository's workflow runs | REST rate limits |
The docs say a higher-limit app reduces the budget left for a user's personal tokens. A user token therefore has less room when an agent uses it.
Secondary limits apply to both
These limits apply to any token. The docs state these points:
- No more than 100 concurrent requests are allowed, shared across REST and GraphQL.
- No more than 900 points per minute are allowed for REST endpoints.
- No more than 80 content-creating requests per minute and 500 per hour are allowed.
- A
GETcosts 1 point. APOST,PATCH,PUT, orDELETEcosts 5 points.
Sources: REST rate limits and Best practices.
Practices to follow
- Create one GitHub App for your team. Install it on the repository for each agent.
- Use a separate installation token for each agent run. Limit each token to one repository with the
repositoriesparameter. - Refresh the token before it expires. Installation tokens expire after 1 hour. Octokit SDKs refresh them for you. Source: Generating an installation access token.
- Queue requests. Make them one after another, not in parallel. The docs advise against concurrent requests.
- Wait at least one second between write requests. This avoids secondary limits.
- Use conditional requests when agents poll. An authorized
304 Not Modifiedresponse does not count against the primary limit. Use webhooks where you can instead of polling. - Read the
x-ratelimit-*headers. When you get a403or429, follow the wait rules. Useretry-afterif it is present. Otherwise wait untilx-ratelimit-reset. If neither applies, wait at least one minute. Then back off exponentially. Do not keep sending requests while rate limited, because the docs warn this can get the integration banned. - Check remaining quota with
GET /rate_limit. It does not count against the primary limit. The response headers are the authoritative source, so rely on them when the two disagree.
How they relate
I checked both projects, and both are active. anthropics/claude-code ✅ was pushed today, its latest release is v2.1.328, and it lists 59 contributors. openai/codex ✅ was pushed today, its latest release is rust-v0.170.0, and it lists 739 contributors. Neither repository documents its own GitHub rate-limit handling in the README I read. I also did not verify how each tool authenticates to GitHub. Check each tool's settings before you assume which token it uses.
Recommendation
Use one GitHub App with one installation per agent, and limit each token to one repository. This keeps each agent's budget separate. It also shows each agent's actions as its own bot.
- Choose a GitHub App if you run two or more agents in the same repository.
- Choose a personal access token only if one person runs one agent on a small, occasional schedule.
If you want each agent to have its own identity, githug does this for you. Each agent gets its own key, which mints one-hour tokens that work on one repository. The hug CLI sets this up for Claude Code, Codex, and other agents that run git. The beta is free.