Examples

Example: a release notes generator with the AI SDK

A standalone AI SDK script that drafts release notes from merged pull requests since the last tag, using the release-manager preset and Vercel Connect.

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

scripts/generate-release-notes.ts
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)
.env
# Vercel Connect OIDC token, required by the "github/my-connector" connector.
# vercel link && vercel env pull
VERCEL_OIDC_TOKEN=
package.json
{
  "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

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:

Terminal
vercel link
vercel env pull

See Vercel Connect for the full checklist, including the @vercel/connect peer dependency.

Run it

Terminal
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.

This script never calls 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 createGithubAgent if you'll run it repeatedly with slightly different instructions
  • Pipe the draft into createRelease behind 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