# Vercel AI SDK adapter for Novu Connect

> Bring an existing Vercel AI SDK agent to Slack, Microsoft Teams, WhatsApp, Telegram, and email while keeping the same model, tools, and application code.


Canonical: https://website-new-git-sync-agent-onboarding-b4fb7b9-novuhq.vercel.app/changelog/vercel-ai-sdk-adapter-for-novu-connect/

Markdown: https://website-new-git-sync-agent-onboarding-b4fb7b9-novuhq.vercel.app/changelog/vercel-ai-sdk-adapter-for-novu-connect.md

Last updated: 2026-08-19T13:39:00.000Z

Bring an existing Vercel AI SDK agent to Slack, Microsoft Teams, WhatsApp, Telegram, and email while keeping the same model, tools, and application code.

Published: 2026-08-19T13:39:00.000Z

Categories: Agent Communication, New Feature, Vercel AI SDK

The Vercel AI SDK adapter is now available through `@novu/framework/ai-sdk`. Your agent continues to run your application. Novu Connect receives messages from each connected channel, passes the conversation context to your handler, and delivers the response that your handler returns.

Install `@novu/framework` with the AI SDK and your model provider:

```bash
npm install @novu/framework ai @ai-sdk/openai
```

## **Use one handler across connected channels**

Return `generateText()` from `onMessage`, and the adapter handles the handoff between Novu conversation history and the Vercel AI SDK.

```typescript
import { agent, toModelMessages } from '@novu/framework/ai-sdk';
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';

export const supportBot = agent('support-bot', {
  onMessage: async (_message, ctx) =>
    generateText({
      model: openai('gpt-4o'),
      instructions: 'You are a helpful support agent.',
      messages: toModelMessages(ctx.history),
    }),
});
```

`toModelMessages(ctx.history)` converts the full conversation into AI SDK messages and already includes the current inbound message. After you connect other channel providers, the same handler can reply on Slack, Microsoft Teams, WhatsApp, Telegram, and email.

## **Keep tool approval in the conversation**

AI SDK tool loops work through the adapter, including actions and tool calls that require a person to approve them. Set `needsApproval: true` on a tool, and Novu posts an Approve / Deny card in the conversation any time the tool is called. The turn pauses until the user decides, then resumes with the decision included in the mapped conversation history.

```typescript
import { agent, toModelMessages } from '@novu/framework/ai-sdk';
import { openai } from '@ai-sdk/openai';
import { generateText, tool } from 'ai';
import { z } from 'zod';

export const supportBot = agent('support-bot', {
  onMessage: async (_message, ctx) =>
    generateText({
      model: openai('gpt-4o'),
      messages: toModelMessages(ctx.history),
      tools: {
        issueRefund: tool({
          inputSchema: z.object({ orderId: z.string() }),
          needsApproval: true,
          execute: async ({ orderId }) => refund(orderId),
        }),
      },
    }),
});
```

You can also use MCP tools through the AI SDK MCP client on the custom-code path. Your application creates the client and supplies its credentials, while Novu Connect handles the conversation and channel delivery.

Get started with `npx novu connect --runtime ai-sdk`, then follow the [AI SDK quickstart](<https://docs.novu.co/agents/get-started/ai-sdk>). See the [AI SDK reference](<https://docs.novu.co/agents/custom-code-agent/frameworks/ai-sdk>) for return types, tool approval, MCP tools, streaming updates, and error handling.
