Queues logo

Queues

Organization
vercel
queues

Vercel Queues guidance — durable topics with at-least-once delivery, independent consumer groups, retries, delays, and idempotency keys via @vercel/queue (JS) or vercel-queue (Python). Use when deferring background work, buffering traffic, fanning out events, or choosing between Queues and Workflows.

Overview

Publishervercel
Repositoryvercel-plugin
Skill namequeues
Stars
286
Forks
56
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by vercel on GitHub. Read the source before you install it.

Installation

Install the Queues AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vercel/vercel-plugin.git /tmp/vercel-plugin
mkdir -p .claude/skills
cp -r /tmp/vercel-plugin/skills/queues .claude/skills/queues
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Queues in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Queues on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Queues is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Vercel Queues

You are an expert in Vercel Queues, the durable message topics that power background work and agent events on Vercel.

What It Is

Vercel Queues (public beta) gives you durable, append-only topics. Producers publish JSON messages, and every subscribed consumer group receives every message with at-least-once delivery and automatic retries. New consumer groups can join later and replay non-expired history. Queues is the primitive under Vercel Workflows; use Queues directly when you need control over publishing, consumption, and routing.

  • Topic: a named durable log of messages, created on first publish
  • Consumer group: an independent subscriber that receives every message on a topic
  • Delivery: at-least-once; handlers must be idempotent
  • Retention: 24 hours by default, up to 7 days; delivery can be delayed up to the retention period
  • Modes: push (Vercel invokes your function) or poll (your own workers pull messages from any environment)

Choose Queues or Workflows

NeedUseWhy
Fire-and-forget background job, fan-out, bufferingQueuesDirect publish/consume, independent consumer groups
Multi-step logic with sleep, hooks, or human approvalWorkflows (⤳ skill: workflow)Durable steps and replay built on top of Queues
Scheduled invocation on a cronCron Jobs (⤳ skill: vercel-functions)Time-based trigger, not message-based

Quickstart (Next.js App Router)

Install the SDK:

bash
npm install @vercel/queue

Publish from any route, Server Action, or function:

ts
// app/api/orders/route.ts
import { send } from '@vercel/queue';

export async function POST(request: Request) {
  const body = await request.json();
  const { messageId } = await send('orders', { orderId: body.orderId, action: 'process' });
  return Response.json({ messageId });
}

Consume with a push-mode handler. Messages are acknowledged when the handler returns and retried when it throws:

ts
// app/api/queues/process-order/route.ts
import { handleCallback } from '@vercel/queue';

export const POST = handleCallback(async (message, metadata) => {
  await processOrder(message);
  console.log('processed', metadata.messageId, 'delivery', metadata.deliveryCount);
});

Register the consumer in vercel.json (or vercel.ts) so Vercel routes the topic to that function:

json
{
  "functions": {
    "app/api/queues/process-order/route.ts": {
      "experimentalTriggers": [{ "type": "queue/v2beta", "topic": "orders" }]
    }
  }
}

Run vercel link and vercel env pull before local development so the SDK can authenticate.

Send Options

ts
await send('orders', payload, {
  region: 'sfo1',            // target a specific region
  retentionSeconds: 3600,    // message TTL; min 60, max 604800 (7 days); default 24 hours
  delaySeconds: 60,          // delay first delivery; max 7 days, capped at the TTL
  idempotencyKey: 'order-123', // duplicates within the retention window are dropped
  headers: { 'x-trace-id': 'abc-123' },
});

Create a QueueClient when you need defaults, a fixed region, or multiple clients:

ts
// lib/queue.ts
import { QueueClient } from '@vercel/queue';

const queue = new QueueClient({ region: 'sfo1' });
export const { send, handleCallback } = queue;

Consumer Options and Retries

handleCallback(handler, options) accepts:

OptionDefaultNotes
visibilityTimeoutSeconds300How long a message stays in flight; the SDK re-extends the lease while the handler runs
retrybuilt-in backoff(error, metadata) => { afterSeconds } | { acknowledge: true } | undefined

Handle poison messages by acknowledging after a delivery-count threshold:

ts
export const POST = handleCallback(processOrder, {
  retry: (error, metadata) => {
    if (metadata.deliveryCount > 5) return { acknowledge: true }; // stop retrying
    return { afterSeconds: Math.min(300, 2 ** metadata.deliveryCount * 5) };
  },
});

metadata includes messageId, deliveryCount, createdAt, expiresAt, topicName, consumerGroup, and region.

For Express, Connect, or Next.js Pages Router handlers use queue.handleNodeCallback(async (message, metadata) => ...) from a QueueClient instance, which takes (req, res).

Other Runtimes and Frameworks

  • Python: vercel-queue publishes and consumes with the same topic model, and FastAPI, Flask, and Django apps can use it; Celery and Dramatiq integrations are documented under the Python backend frameworks.
  • Nitro / Nuxt: declare vercel.queues.triggers in nitro.config.ts and handle messages with the vercel:queue runtime hook; send from @vercel/queue works in any server route.
  • Poll mode: pull messages from your own workers in any environment when push delivery to a Vercel Function does not fit.
  • Payloads: JSON by default; use BufferTransport for binary or StreamTransport for large bodies when constructing a QueueClient.

Errors

@vercel/queue exports typed errors: UnauthorizedError, BadRequestError, DuplicateMessageError (idempotency-key collision), MessageNotFoundError, and QueueEmptyError.

Common Pitfalls

  1. Missing trigger: a handleCallback route with no experimentalTriggers entry never receives messages. Register every consumer in vercel.json/vercel.ts.
  2. Non-idempotent handlers: delivery is at-least-once. Key side effects on metadata.messageId or your own idempotencyKey.
  3. Retrying forever: without a retry policy that acknowledges poison messages, a permanently failing message is redelivered until it expires.
  4. Using Queues for multi-step logic: if you need sleep, hooks, or approvals between steps, use Workflows instead of chaining topics by hand.
  5. Local dev without credentials: run vercel link and vercel env pull first; otherwise send() fails with UnauthorizedError.

References

Frequently asked questions

What does the Queues AI skill do?

Vercel Queues guidance — durable topics with at-least-once delivery, independent consumer groups, retries, delays, and idempotency keys via @vercel/queue (JS) or vercel-queue (Python). Use when deferring background work, buffering traffic, fanning out events, or choosing between Queues and Workflows.

Why use Queues on TypingMind?

Because you install it once and use it with any model. Queues is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Queues in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/vercel/vercel-plugin/tree/main/skills/queues. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Queues?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Queues?

As many as you like. As long as a model supports skills, you can use Queues with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Queues AI skill free?

It is published on GitHub by vercel. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇