Example: a release notes generator with the AI SDK
Build a release notes generator with the AI SDK
A one-shot script: compare the latest two tags, list every PR merged in between, and draft grouped release notes (features, fixes, other) ready to paste into a GitHub release. Read-only except for createRelease, which stays off unless you opt in.
Files
import { connectGithubTools } from '@github-tools/sdk/connect'
import { generateText } from 'ai'
const owner = process.argv[2]
const repo = process.argv[3]
if (!owner || !repo) {
console.error('Usage: tsx scripts/generate-release-notes.ts <owner> <repo>')
process.exit(1)
}
const { text } = await generateText({
model: 'anthropic/claude-sonnet-4.6',
tools: connectGithubTools('github/my-connector', { preset: 'release-manager' }),
prompt: `
On ${owner}/${repo}, find the two most recent releases (or tags if there are no releases yet).
Compare them to list every pull request merged in between.
Draft release notes grouped into "Features", "Fixes", and "Other", one bullet per PR,
each linking the PR number. Do not create the release, just print the draft.
`,
})
console.log(text)
# Vercel Connect OIDC token, required by the "github/my-connector" connector.
# vercel link && vercel env pull
VERCEL_OIDC_TOKEN=
{
"name": "release-notes-generator",
"private": true,
"type": "module",
"scripts": {
"generate": "tsx scripts/generate-release-notes.ts"
}
}
Install
pnpm add @github-tools/sdk @vercel/connect ai zod
npm install @github-tools/sdk @vercel/connect ai zod
yarn add @github-tools/sdk @vercel/connect ai zod
bun add @github-tools/sdk @vercel/connect ai zod
Set up the connector
Create a github/my-connector connector from the Vercel dashboard, install it on the repositories you cut releases for, then pull a local OIDC token:
vercel link
vercel env pull
See Vercel Connect for the full checklist, including the @vercel/connect peer dependency.
Run it
pnpm generate vercel-labs github-tools
The model calls compareCommits and listPullRequests under release-manager, then returns a formatted draft, no approval prompts, since nothing in this script writes.
createRelease. If you want the agent to publish the release too (not just draft it), add that tool back with requireApproval: true, see Control write safety.Go further
- Wrap the same prompt in
createGithubAgentif you'll run it repeatedly with slightly different instructions - Pipe the draft into
createReleasebehind an approval gate to publish automatically once a human signs off - Move this into a scheduled Vercel Workflow if you want it to run on a cron instead of by hand
Stale issue triager
Build an eve agent that finds inactive GitHub issues, asks the author for an update, and closes them if nothing comes back, all files included.
CI failure bot
A durable chat backend that diagnoses failing GitHub Actions runs, built with createDurableGithubAgent, the ci-ops preset, and Vercel Connect.