@relayapp/vercel-ai turns a Vercel AI SDK backend into a Relay agent: it receives signed message.received webhooks and forwards streamText(...) output to Relay, which commits one canonical message. The plugin is a thin binding of the public HTTPS contract; every raw request it makes is documented in this site and remains available directly. Prerequisites: an agent and its Agent Token (Create and connect an agent) and a registered webhook with its signing secret (Webhooks).
The plugin lives in the public relaymessenger/relayapp workspace under integrations/vercel-ai and publishes to npm with the next relayapp release.

Quickstart

app/api/relay/route.ts
Mount the handler as the POST route your webhook registration points at. The handler works in any WinterCG runtime: Next.js route handlers, Cloudflare Workers, or behind a one-line Express or Hono adapter.

What the plugin enforces

Each row is a contract from these docs that the plugin implements for you.

Configuration

On serverless platforms that support work after the response, pass the platform’s waitUntil as the second handler argument to acknowledge 202 immediately and keep generating: relay.webhook(handler) returns a function of (request, { waitUntil }). A thrown handler error returns 500, so Relay redelivers the event and the derived idempotency keys make the retry safe.

Handler context

Next steps