GitHub Tools
Frameworks
Call GitHub from generateText, streamText, or a ToolLoopAgent — the core integration path for @github-tools/sdk in any Vercel AI SDK app.

The AI SDK is the core integration path: createGithubTools() returns a standard AI SDK ToolSet, so GitHub tools work anywhere AI SDK tools do — generateText, streamText, agent loops, and any framework built on top of them.

Wire GitHub tools into this AI SDK app

One-shot: generateText

Pass the tools and let the model decide which GitHub operations to call:

summarize.ts
import { createGithubTools } from '@github-tools/sdk'
import { generateText } from 'ai'

const { text } = await generateText({
  model: 'anthropic/claude-sonnet-4.6',
  tools: createGithubTools({ preset: 'code-review' }),
  prompt: 'Summarize the latest merged PR on vercel/ai.',
})

Best for scripts, CLI tools, batch jobs, and webhooks.

Streaming: streamText

Same tools, streamed output — for chat UIs and interactive terminals:

stream.ts
import { createGithubTools } from '@github-tools/sdk'
import { streamText } from 'ai'

const result = streamText({
  model: 'anthropic/claude-sonnet-4.6',
  tools: createGithubTools({ preset: 'repo-explorer' }),
  prompt: 'Explain the architecture of vercel-labs/github-tools.',
})

for await (const chunk of result.textStream) {
  process.stdout.write(chunk)
}

Reusable agent: createGithubAgent

createGithubAgent returns a ToolLoopAgent with tools, preset-aware system instructions, and approval policy wired together. Define it once, call .generate() or .stream() everywhere:

agent.ts
import { createGithubAgent } from '@github-tools/sdk'

const reviewer = createGithubAgent({
  model: 'anthropic/claude-sonnet-4.6',
  preset: 'code-review',
  requireApproval: false,
  additionalInstructions: 'Always cite file paths and line numbers.',
})

const { text } = await reviewer.generate({
  prompt: 'Review PR #42 on vercel-labs/github-tools.',
})

Each preset ships a tailored system prompt — additionalInstructions appends to it, instructions replaces it entirely.

Human approval in the loop

Write tools carry needsApproval by default. When the model calls one, the AI SDK emits an approval request instead of executing — your app approves or denies, then execution continues:

approval.ts
const tools = createGithubTools({
  preset: 'maintainer',
  requireApproval: {
    mergePullRequest: true,
    addIssueComment: false,
  },
})

Full policy options (including overrides.needsApproval): Control write safety.

Trim tool context with toolpick

With all 42 tools visible on every step, tool definitions eat tokens. toolpick selects only the most relevant tools per step:

with-toolpick.ts
import { createGithubTools } from '@github-tools/sdk'
import { createToolIndex } from 'toolpick'
import { generateText } from 'ai'
import { openai } from '@ai-sdk/openai'

const tools = createGithubTools()
const index = createToolIndex(tools, {
  embeddingModel: openai.embeddingModel('text-embedding-3-small'),
})

const result = await generateText({
  model: openai('gpt-4o'),
  tools,
  prepareStep: index.prepareStep(),
  prompt: 'Check if the CI is passing on the main branch of vercel/ai.',
})

Cherry-pick individual tools

Every tool is also exported as a standalone factory — compose your own minimal tool set:

cherry-pick.ts
import { listPullRequests, getPullRequest, listPullRequestFiles } from '@github-tools/sdk'

const tools = {
  listPullRequests: listPullRequests(token),
  getPullRequest: getPullRequest(token),
  listPullRequestFiles: listPullRequestFiles(token),
}

See the Tools Catalog for all 42 factories.

When to level up

NeedGo to
A standalone agent in 3 files, richer approval (once, predicates)eve
Crash-safe execution, retries, resumable streamsVercel Workflow
A GitHub/Slack/Discord botChat SDK

External references