Skip to content

Feature: integrate Vercel Chat SDK for persistent bot mode & streaming AI replies #41

Description

@AmethystLiang

Context

Vercel just released the Chat SDK (beta, Feb 2026) — a unified TypeScript library for building bots across Slack, Discord, MS Teams, and more. It provides event-driven handlers, AI SDK streaming, universal JSX-based UI (renders to each platform native blocks), and pluggable state management.

agent-slack is currently command-driven (one-shot CLI calls). Chat SDK is event-driven (persistent listeners). These are complementary — combining them would unlock new capabilities without duplicating effort.


Proposed integration surface

1. New bot listen command (highest value)

Add a persistent bot mode that uses Chat SDK Slack adapter under the hood:

# Start a bot that responds to @mentions with an AI agent
agent-slack bot listen "#support" --ai-provider anthropic --model claude-sonnet-4-6

# Listen on multiple channels
agent-slack bot listen "#support" "#engineering" --ai-provider openai --model gpt-4

How it works internally:

import { Chat, createSlackAdapter } from "@vercel/chat-sdk";
import { getStoredAuth } from "../auth"; // reuse agent-slack zero-config auth

export async function botListen(channels: string[], opts: BotOpts) {
  const { token, cookie } = await getStoredAuth();

  const bot = new Chat({
    userName: "agent-slack-bot",
    adapters: {
      slack: createSlackAdapter({ token }),
    },
  });

  bot.onNewMention(async (thread, message) => {
    // Use AI SDK to stream a response
    const result = await generateText({
      model: opts.aiProvider(opts.model),
      prompt: message.text,
    });
    await thread.post(result.textStream); // streams token-by-token into Slack
  });

  bot.onSlashCommand("/ask", async (thread, command) => {
    const result = await generateText({
      model: opts.aiProvider(opts.model),
      prompt: command.text,
    });
    await thread.post(result.textStream);
  });

  console.log(`Listening on ${channels.join(", ")}...`);
}

Why this matters: Today agent-slack users can only do one-shot CLI calls triggered by an external agent. This would let them spin up a persistent, event-driven bot that lives inside a channel — no separate project needed.


2. Streaming AI replies via message send

Currently message send posts a complete message. With Chat SDK streaming, we could progressively update a message as the AI generates tokens:

agent-slack message send "#general" --stream --ai-prompt "Summarize the last 10 messages in this channel"

Implementation sketch:

// 1. Post an initial placeholder message
const msg = await slack.postMessage(channel, "Thinking...");

// 2. Stream AI response, updating the message in-place
const stream = await agent.stream({ prompt });
for await (const chunk of stream) {
  await slack.updateMessage(channel, msg.ts, chunk.accumulatedText);
}

This gives the same "typing" experience users see in ChatGPT/Claude, but inside Slack.


3. Rich Block Kit via Chat SDK JSX renderer

Chat SDK provides a JSX abstraction that renders to each platform native UI. agent-slack could use this to let agents send rich cards without hand-crafting Block Kit JSON:

agent-slack message send "#general" --card '{"title":"PR #42 Review","status":"approved","fields":{"author":"@alice","tests":"passing"}}'

Internally, agent-slack would use Chat SDK JSX renderer to convert this to Slack Block Kit.


4. Chat SDK adapter powered by agent-slack auth

agent-slack zero-config auth (extracting tokens from Slack Desktop/Chrome) is its biggest differentiator. This could be packaged as a Chat SDK adapter for local development:

import { Chat } from "@vercel/chat-sdk";
import { createAgentSlackAdapter } from "agent-slack/adapter";

const bot = new Chat({
  adapters: { slack: createAgentSlackAdapter() }, // zero-config, no OAuth app setup
});

This would make Chat SDK usable for local prototyping without going through Slack OAuth app registration flow.


Implementation plan

  1. Add @vercel/chat-sdk as an optional peer dependency (keep the CLI lightweight for users who don't need bot mode)
  2. Implement agent-slack bot listen — wire agent-slack auth into Chat SDK Slack adapter
  3. Add --stream flag to message send — use Chat SDK streaming post capability
  4. Export an adapter module (agent-slack/adapter) for Chat SDK users who want zero-config auth

Open questions

  • Should bot listen require a standard bot token (xoxb-) or work with the browser-extracted tokens that agent-slack uses today?
  • Should the AI provider be pluggable (AI SDK pattern) or opinionated (e.g. default to a specific provider)?
  • Is there interest in packaging agent-slack auth as a standalone Chat SDK adapter?

Would love to hear thoughts on which of these would be most useful to prioritize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions