Scope with Presets
The SDK ships a large tool catalog so you can build almost any GitHub agent. Presets are how you keep that catalog out of the model's context: each preset exposes only the tools for one workflow. Start with the smallest preset that fits; use maintainer or omit preset when you need the full surface.
Tighten GitHub tool scope with presets
Compose agents around presets
| Shape | When to use |
|---|---|
| One preset | A single job (review PRs, triage issues, cut releases) |
| Array of presets | One agent that spans a few related domains |
| Manager + sub-agents | Several distinct roles — each specialist mounts one preset (example) |
maintainer / omit preset | Prototyping or a genuine need for the full catalog |
Apply a single preset
Use a preset to restrict the tools to a specific capability domain. For example, a code review agent only needs pull request and commit tools:
import { createGithubTools } from '@github-tools/sdk'
const tools = createGithubTools({
preset: 'code-review',
})
Focused operator workflows:
import { createGithubTools } from '@github-tools/sdk'
const tools = createGithubTools({
preset: 'security-audit',
})
import { createGithubTools } from '@github-tools/sdk'
const tools = createGithubTools({
preset: 'pr-author',
})
Combine multiple presets
When a workflow spans multiple domains, pass an array. This agent can both review PRs and manage issues:
import { createGithubTools } from '@github-tools/sdk'
const tools = createGithubTools({
preset: ['code-review', 'issue-triage'],
})
Let the agent pick presets
When one agent handles open-ended requests, use preset: 'auto':
import { createGithubAgent } from '@github-tools/sdk'
const agent = createGithubAgent({
model: 'anthropic/claude-opus-5.5',
preset: 'auto',
})
await agent.generate({ prompt: 'Why is CI failing on main?' })
// runs with the ci-ops tools and system prompt
On each call, a fast evaluation model reads the latest user message and rates how likely it is to need each preset. The agent then exposes only the tools of the chosen presets, and uses the preset's system prompt when exactly one is chosen. The full catalog is never exposed:
- Presets rated at or above
0.7are used, most likely first, up to two per call. - The read-only
repo-explorerpreset is only used when no other preset qualifies, since every other preset already has the read tools its task needs. - When none reaches
0.7, the single most likely preset is used. When nothing stands out, as with "hello", that isrepo-explorer.
preset: 'auto' is available on createGithubAgent and needs ai 7.0.105 or later. To tune it, use evaluation: { minPresetProbability, maxPresets, model }. The default model is Jev from TypeSafe AI. If the evaluation call fails (model not enabled on AI Gateway, no credits, outage), the call uses read-only repo-explorer and logs a github_tools.EVALUATION_FAILED warning through console.warn.
Pick the right preset
| Preset | Tools included | Use case |
|---|---|---|
repo-explorer | repository metadata, branches, file content, repo tree, code and issue search, discussions, gists, workflows, checks/statuses, releases | knowledge retrieval, repo Q&A |
ci-ops | workflows, runs, jobs, job logs, checks/statuses, commits, repository context | CI monitoring, build ops |
code-review | pull requests, commits, compare diff, file diffs, checks/statuses, updates, review comments, review threads, reviewer requests | PR copilots, change summaries |
issue-triage | issues, issue search, labels, comments, reactions, assignees, close/create/update/reopen | support triage, backlog bots |
security-audit | read-only exploration, code and issue search, PR/CI visibility, checks/statuses, compare diff, plus issue creation to report findings | vulnerability scanning, risk reporting |
release-manager | releases, compare diff, commits, workflow runs, pull requests, update/delete releases | changelog generation, release cutting |
discussion-moderator | discussions list/get/comment, plus light issue context | forum / Q&A bots |
notification-inbox | notifications list/mark-read, plus get issue/PR/repo | inbox triage (needs a Notifications PAT) |
pr-author | branches (create/delete), file edits, create/update pull requests, review threads, compare | open focused PRs and address review feedback without full maintainer |
maintainer | all tool families including branch creation, forking, repo creation, discussions, notifications, gists, and workflows | full operator workflows with approval control |
Pair presets with token scopes
Each preset maps to specific GitHub token permissions:
repo-explorer: read-only token, no write permissions needed (adddiscussions: readfor the discussion tools)code-review: addpull_requests: writeonly if comments or reviewer requests are neededissue-triage: addissues: write(also covers reactions)ci-ops: addactions: writefor triggering, cancelling, and re-running workflowssecurity-audit: read-only token, plusissues: writeto report findingsrelease-manager: addcontents: writefor creating releases,actions: writeif triggering release pipelinesdiscussion-moderator: adddiscussions: writeandissues: writefor cross-linking repliesnotification-inbox: repository read scopes plus a user PAT with the "Notifications" account permission (not available on Connect installation tokens)pr-author: addcontents: writeandpull_requests: writemaintainer: all write scopes, always paired with approval control; notification tools additionally need a PAT with the "Notifications" account permission