answered from live GitHub & Hugging Face data

What are the differences in scope and expiry between fine-grained PATs and GitHub App installation tokens for AI agents?

For AI agents, use a GitHub App installation token. It expires after one hour and can be limited to chosen repositories and permissions. A fine-grained personal access token (PAT) is tied to one person and can last much longer.

Property Fine-grained PAT GitHub App installation token
Who it acts as The user who created it. Tokens "are tied to the user who generated them" (docs). The app. "API requests made by an app installation are attributed to the app" (docs).
Expiry Chosen at creation. "Infinite lifetimes are allowed but may be blocked by a maximum lifetime policy" (docs). "The installation access token will expire after 1 hour" (docs).
Repository scope Set to one resource owner. Repositories are chosen from "Only select repositories" or all. Optional repositories or repository_ids in the token request. Up to 500 repositories. It "cannot be granted access to repositories that the installation was not granted access to."
Permission scope Fine-grained permissions chosen at creation. Optional permissions in the request. If omitted, the token gets "all of the permissions that were granted to the app." It "cannot be granted permissions that the app was not granted."
Limit on count 50 tokens per user. No stated per-user token limit in the pages I read.
Inactivity Removed after one year unused, per the PAT docs. Not stated for installation tokens. The token itself expires after one hour.

Scope gaps that matter for agents

Fine-grained PATs cannot do everything. The docs list these gaps:

Classic PATs cover some of these gaps. They also grant access to "all repositories within the organizations that you have access to" (docs). That is the wider scope to avoid for agents.

Organization controls

Other token types to know

Recommendation

Use a GitHub App for agents. The PAT docs say long-lived integrations should use a GitHub App. A short token limited to one repository is safer than a long-lived PAT tied to a person.

If you run more than one agent, give each agent its own identity. One shared app shows all agents as the same bot. githug is one option for this. Each agent gets its own key. That key mints one-hour tokens that work on one repository, through a GitHub App with least-privilege permissions. The tool is in beta and free for now.

docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokensdocs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-appdocs.github.com/en/authentication/keeping-your-account-and-data-secure/token-expiration-and-revocationdocs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installationdocs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 10/11/2026

Ask your own open-source question →