Vercel AI SDK Provider

Use Composio with Vercel AI SDK

Vercel AI SDK allows you to configure an optional async execute function that the framework uses to execute the tool calls.

The Vercel provider for Composio formats the Composio tools and adds this execute function to the tool calls.

Setup

Vercel AI SDK and the provider are only available for the TypeScript SDK.

TypeScript
1npm install @composio/vercel

You can specify and import the provider in the constructor.

TypeScript
1import { Composio } from '@composio/core';
2import { VercelProvider } from '@composio/vercel';
3import { generateText } from 'ai';
4import { openai } from "@ai-sdk/openai";
5
6const composio = new Composio({
7 provider: new VercelProvider(),
8});

Usage

TypeScript
1// create an auth config for gmail
2// then create a connected account with an external user id that identifies the user
3const externalUserId = "your-external-user-id";
4const tools = await composio.tools.get(externalUserId, "GMAIL_SEND_EMAIL");
5
6// env: OPENAI_API_KEY
7const { text } = await generateText({
8 model: openai("gpt-5"),
9 messages: [
10 {
11 role: "user",
12 content: `Send an email to soham.g@composio.dev with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
13 },
14 ],
15 tools,
16});
17
18console.log("Email sent successfully!", { text });