Show HN: Channels SDK – 将任意智能体接入任意渠道(Slack、MS Teams)

Hacker News Top 工具

摘要

CopilotKit 宣布推出 Channels SDK,这是一个开源工具包,让开发者能够将任何兼容 AG-UI 的 AI 智能体连接到 Slack、Microsoft Teams 和 Discord,并支持原生交互式界面、工具调用和人工审批门控。

暂无内容
查看原文
查看缓存全文

缓存时间: 2026/08/06 17:03

CopilotKit/channels-sdk 来源: https://github.com/CopilotKit/channels-sdk

Channels SDK

将任何 AI 智能体带入 Slack、Microsoft Teams 以及工作发生之处——以原生、交互式 UI。

试用 Channels (https://www.copilotkit.ai/try-channels) · 使用 SDK 构建 · 探索 OpenTag npm (https://www.npmjs.com/package/@copilotkit/channels) 许可证: MIT

https://github.com/user-attachments/assets/9f33e7d1-9364-4fe0-b82f-acd707097028

你的智能体保留其工具、模型和业务逻辑。Channels 为它提供了一个与人们协作的原生场所。

你的智能体属于工作发生之处

Channels 将兼容 AG-UI 的智能体连接到你的团队已在使用的通信平台。该智能体可以理解对话、流式传输响应、调用工具、处理文件、渲染交互式 UI,并在人工审批时暂停。

接入你的智能体渲染原生 UI让人掌控全局
使用 CopilotKit 内置智能体,或连接 LangGraph、CrewAI、Mastra、Pydantic AI、Google ADK 及其他 AG-UI 智能体。一次描述消息,即可将其渲染为原生 Slack Block Kit、Teams Adaptive Cards 和特定平台的 UI。在智能体采取行动之前,直接将按钮、选项和审批闸门放入对话中。

一次交互,原生适配每个渠道

SlackMicrosoft TeamsDiscord

Channels 面向同一个智能体可以在每个通信界面上与用户会面的世界而构建。通过 CopilotKit Intelligence 提供 Slack 和 Microsoft Teams 的托管连接,更多渠道正在推出。

在构建之前先试用

无需配置应用、运行时或提供商凭据,即可在 Slack 或 Microsoft Teams 中体验真实的 Channels 智能体。

试用 Channels → (https://www.copilotkit.ai/try-channels)

选择一个平台,加入体验,看看智能体如何处理上下文、工具使用和原生渠道 UI。

构建你的第一个 Channel

你的智能体和应用程序逻辑在你的基础设施中运行。CopilotKit Intelligence 管理平台连接,并将每一轮交互传送到你的长期运行的 Channels 进程。

最快的路径:让编码智能体驱动

构建 Channels 智能体涉及一个项目、一个智能体、一个托管 Channel、一个提供商应用和一个长期运行的运行时。一份指南会引导你的智能体完成这一切。

npx copilotkit@latest channels setup 

这会安装 channels-setup 技能,打印一段提示,并将其复制到你的剪贴板。把它粘贴到你的编码智能体中。该技能是一个指针——当你的智能体需要时,它会从 copilotkit.ai/channels-guide.md (https://copilotkit.ai/channels-guide.md) 获取工作流,因此即使已安装的技能已有数月之久,步骤也始终是最新的。

该指南会询问你想要的平台(Slack 或 Microsoft Teams)以及智能体框架。你的智能体会在你自己已登录的会话中自行操作 Slack 和 Intelligence 控制台。如果它还没有浏览器或计算机使用工具,它会要求你先添加一个——这是预期路径,而不是后备方案。你来输入机密信息;它负责点击。

或者将 Slack 设置技能安装到磁盘上

跳过托管指南,将 Slack 工作流直接放入你已在运行的编码智能体中:

npx copilotkit@latest skills install --skill setup-slack-channel -y 

-y 会安装该技能,而不打开选择器。该技能仅适用于 Slack——对于 Microsoft Teams,请使用上面的指南。CLI 涵盖 Intelligence 侧:copilotkit channels add --adapter slack 声明 Channel 并附加适配器,copilotkit channels status 会比较你的配置、代码和服务器。留在浏览器中的是提供商侧——创建 Slack 应用并将其安装到工作区——以及发放项目 API 密钥。没有 CLI 标志接受凭据值,因此机器人令牌和签名密钥会留在你的 .env 文件和你的手中。

提示:遇到 Unknown option '--skill'? 一个较旧的 copilotkit——全局安装或留在 npx 缓存中——正在遮蔽当前 CLI。保留 @latest;这会强制 npx 获取当前版本,而不是复用已有的版本。下面的步骤是同样的路径,手动完成。

1. 配置连接

在 CopilotKit Intelligence (https://docs.copilotkit.ai/channels) 中创建一个 Channel 并连接 Slack。请保留 Channel Code 和项目范围的 Intelligence API 密钥,供后续步骤使用。你需要 Node.js 22 或更高版本,以及一个长期运行的 Node 进程或容器。

2. 安装 SDK

npm install @copilotkit/channels @copilotkit/runtime
npm install --save-dev tsx typescript @types/node
npm pkg set type=module

Channels 和 Runtime 作为经过测试的一对一起发布。请同时升级这两个包。

3. 创建监听器

下面的示例使用 CopilotKit 的内置智能体。你可以将 makeAgent 替换为任何兼容 AG-UI 的智能体工厂,而无需更改 Channel 生命周期。

// channel.ts
import { createServer } from "node:http";
import { createChannel } from "@copilotkit/channels";
import {
  BuiltInAgent,
  CopilotKitIntelligence,
  CopilotRuntime,
} from "@copilotkit/runtime/v2";
import { createCopilotNodeListener } from "@copilotkit/runtime/v2/node";

function required(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Missing required environment variable: ${name}`);
  return value;
}

function makeAgent(threadId: string) {
  const agent = new BuiltInAgent({ model: "openai:gpt-5.4-mini" });
  agent.threadId = threadId;
  return agent;
}

const channel = createChannel({
  name: required("CHANNEL_CODE"),
  identifyUser: "platform",
  agent: makeAgent,
});

channel.onMessage(async ({ thread, message }) => {
  await thread.runAgent({
    prompt: message.contentParts?.length
      ? [
          ...(message.text ? [{ type: "text" as const, text: message.text }] : []),
          ...message.contentParts,
        ]
      : message.text,
    context: [{ description: "Originating platform", value: message.platform }],
  });
});

const intelligence = new CopilotKitIntelligence({
  apiKey: required("INTELLIGENCE_API_KEY"),
});

const runtime = new CopilotRuntime({
  agents: {},
  intelligence,
  identifyUser: () => ({ id: "channels-runtime",

相似文章

Channels SDK

Product Hunt

Channels SDK 使开发者能够将 AI 代理部署到 Slack 和 Teams,而无需面对常见的生产环境痛点。

Switch

Product Hunt

# Switch: Bring any AI agent into Slack, Teams & Discord. Open-source. | Product Hunt Source: [https://www.producthunt.com/products/switch-11](https://www.producthunt.com/products/switch-11) Switch brings AI agents into the collaboration tools your team already uses\. Agents join as named participants in your Slack, Teams, Discord, or Telegram channels, sharing the same context and history as your team\. Connect an agent once and use it across projects\. Each room carries its own context, partic

AgentChat

Product Hunt

AgentChat 是一个新推出的消息平台,专为 AI 智能体之间的通信而设计,近期在 Product Hunt 上亮相。