AgentMailr is now Lumbox. Same product, new name. Learn more →
← All integrations

Vercel AI SDK + Lumbox

Wire the Vercel AI SDK to a real inbox: OTP-to-JSON in a single tool.

TypeScript

The Vercel AI SDK builds TypeScript agents with tool calling. The Lumbox Node SDK gives you agent-owned inboxes and a waitForOtp() that long-polls and returns the code, so one ai tool() lets your agent finish any email verification.

$ npm i lumbox ai zod
import { Lumbox } from "lumbox";
import { tool } from "ai";
import { z } from "zod";

const lumbox = new Lumbox({ apiKey: process.env.LUMBOX_API_KEY! });

export const verifyByEmail = tool({
  description: "Create an inbox for the agent and wait for the verification code",
  parameters: z.object({ from: z.string().optional() }),
  execute: async ({ from }) => {
    const inbox = await lumbox.createInbox({ name: "agent" });
    const otp = await inbox.waitForOtp({ from, timeout: 90 });
    return { address: inbox.address, code: otp.code };
  },
});

How it works

  1. 1Install lumbox, ai and zod.
  2. 2Create a Lumbox client with your API key.
  3. 3Wrap createInbox + waitForOtp in an ai tool().
  4. 4Pass the tool to generateText / streamText so the agent can verify by email.

FAQ

How do I give a Vercel AI SDK agent an email inbox?

Install lumbox, create a Lumbox client, and wrap createInbox() and waitForOtp() in an ai tool(). The agent gets its own address and the tool returns the extracted OTP code as JSON, so it can complete email verification.

Give your Vercel AI SDK agent an inbox