Skip to main content
Providers

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.

npm install @composio/vercel

You can specify and import the provider in the constructor.

import { Composio } from '@composio/core';
import { VercelProvider } from '@composio/vercel';
import { generateText } from 'ai';
import { openai } from "@ai-sdk/openai";

const composio = new Composio({
  provider: new VercelProvider(),
});

Usage

// create an auth config for gmail
// then create a connected account with an external user id that identifies the user
const externalUserId = "your-external-user-id";
const tools = await composio.tools.get(externalUserId, "GMAIL_SEND_EMAIL");

// env: OPENAI_API_KEY
const { text } = await generateText({
  model: openai("gpt-5"),
  messages: [
    {
      role: "user",
      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!'`,
    },
  ],
  tools,
});

console.log("Email sent successfully!", { text });

On this page