Show HN:Channels SDK——将任意 Agent 接入任意沟通渠道(Slack、Microsoft Teams)
英文标题:🔶 Show HN: The Channels SDK – Bring Any Agent to Any Channel (Slack, MS Teams)
CopilotKit 发布 Channels SDK,可将兼容 AG-UI 的 Agent 接入 Slack、Microsoft Teams,并计划支持更多沟通平台。该 SDK 让 Agent 保留自身的模型、工具和业务逻辑,同时提供原生消息 UI、文件处理、工具调用、流式响应及人工审批能力。开发者可使用 CopilotKit 内置 Agent,也可接入 LangGraph、CrewAI、Mastra、Pydantic AI、Google ADK 等框架;自身负责运行时、模型凭据和业务逻辑,CopilotKit Intelligence 负责平台连接、事件投递与健康管理。项目以 MIT 协议开源,并提供 OpenTag 作为生产形态的完整参考应用。
961.2 KB
469.4 KB
432.8 KB
456.9 KB
1020.3 KB
72.5 KB
中文
你的 Agent 可以保留自己的工具、模型和业务逻辑。Channels 为它提供了一个能与人协作的原生工作场所。
你的 Agent 应该在工作发生的地方工作
Channels 可将兼容 AG-UI 的 Agent 连接到团队已在使用的沟通平台。Agent 能理解对话、流式输出回复、调用工具、处理文件、渲染交互式 UI,并在需要人工批准时暂停。
| 接入你的 Agent | 渲染原生 UI | 保持人工掌控 |
|---|---|---|
| 使用 CopilotKit 内置 Agent,或连接 LangGraph、CrewAI、Mastra、Pydantic AI、Google ADK 及其他 AG-UI Agent。 | 一次描述消息,即可将其渲染为原生 Slack Block Kit、Teams Adaptive Cards 和平台专属 UI。 | 在 Agent 执行操作前,直接在对话中加入按钮、选项和审批关卡。 |
一次交互,原生适配每个渠道
| Slack | Microsoft Teams | Discord |
|---|---|---|
![]() |
![]() |
![]() |
Channels 面向这样一个世界而构建:同一个 Agent 可以在所有沟通界面上与用户会面。通过 CopilotKit Intelligence 可获得托管的 Slack 和 Microsoft Teams 连接,更多渠道即将推出。
在构建前先试用
无需配置应用、运行时或提供商凭据,即可在 Slack 或 Microsoft Teams 中体验真实的 Channels Agent。
选择一个平台,加入体验,了解 Agent 如何处理上下文、使用工具和呈现原生渠道 UI。
你的 Agent 和应用逻辑运行在自己的基础设施中。CopilotKit Intelligence 负责管理平台连接,并将每一轮交互投递给长期运行的 Channels 进程。
最快路径:让你的编码 Agent 来完成
构建一个 Channels Agent 涉及项目、Agent、托管 Channel、提供商应用和长期运行的运行时。只需一份指南,就能引导你的 Agent 完成所有工作。
npx copilotkit@latest channels setup
该命令会安装 channels-setup skill、打印提示词并将其复制到剪贴板。将它粘贴到你的编码 Agent 中。
这个 skill 是一个指针——当你的 Agent 需要时,它会从 copilotkit.ai/channels-guide.md 获取工作流。因此,即使已安装的 skill 已有数月之久,步骤仍保持最新。该指南会询问你希望使用 Slack 还是 Microsoft Teams,以及要使用哪种 Agent 框架。
你的 Agent 会在你本人已登录的会话中自行操作 Slack 和 Intelligence 控制台。如果它还没有浏览器或计算机操作工具,会先要求你添加一个——这正是预期流程,而非备用方案。你输入密钥,它负责点击操作。
或者,将 Slack 配置 skill 安装到本地磁盘
跳过托管指南,直接将 Slack 工作流放入你当前运行的编码 Agent:
npx copilotkit@latest skills install --skill setup-slack-channel -y
-y 会跳过选择器,直接安装该单一 skill。这个 skill 仅适用于 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 中创建 Channel并连接 Slack。请保留 Channel Code 和项目范围的 Intelligence API 密钥,供后续步骤使用。
你需要 Node.js 22 或更高版本,以及一个长期运行的 Node 进程或容器。
npm install @copilotkit/channels @copilotkit/runtime
npm install --save-dev tsx typescript @types/node
npm pkg set type=module
Channels 和 Runtime 作为经过测试的一对组件一同发布。升级时请同时升级这两个包。
以下示例使用 CopilotKit 内置 Agent。无需改变 Channel 生命周期,只要将 makeAgent 替换为任意兼容 AG-UI 的 Agent 工厂即可。
// 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",
name: "Channels Runtime",
}),
channels: [channel],
});
const listener = createCopilotNodeListener({
runtime,
basePath: "/api/copilotkit",
});
const channels = listener.channels;
if (!channels) throw new Error("Channels control surface was not created.");
const server = createServer(listener);
const shutdown = async () => {
await channels.stop();
if (server.listening) server.close();
};
process.once("SIGINT", shutdown);
process.once("SIGTERM", shutdown);
await channels.ready({ timeoutMs: 30_000 });
const status = channels.status();
if (status.overall !== "online") {
throw new Error(`Channel is not online: ${JSON.stringify(status)}`);
}
const port = Number(process.env.PORT ?? 3000);
server.listen(port, () => {
console.log(`Channel online; lifecycle server listening on :${port}`);
});
# .env
OPENAI_API_KEY=<openai-api-key>
INTELLIGENCE_API_KEY=<project-api-key>
CHANNEL_CODE=<channel-code-from-intelligence>
PORT=3000
node --env-file=.env --import tsx channel.ts
当 Intelligence 报告 Online 后,将该应用邀请到 Slack 频道并提及它。你的 Agent 现在会接收对话,并在线程中回复。
想使用 Microsoft Teams、其他 Agent 框架、交互式审批、文件功能,或获取生产部署指导?请继续阅读 Channels 文档。
希望让你的 Agent 来完成? 从上文的最快路径运行
npx copilotkit@latest channels setup。该指南覆盖相同的配置流程,以及提供商配置和验证步骤。
每一轮交互都遵循相同路径:
- 用户在 Slack 或 Microsoft Teams 中向你的应用发送消息。
- CopilotKit Intelligence 接收平台事件,并将其投递给你的 Channels 进程。
- Channels 通过 AG-UI 运行你的 Agent、执行工具并渲染结果。
- Intelligence 将原生平台 UI 回传至对话中。
| 你负责运行 | CopilotKit Intelligence 负责管理 |
|---|---|
| 你的 Agent、模型凭据、工具和业务逻辑 | Slack 和 Microsoft Teams 平台凭据 |
| 长期运行的 Channels 监听器 | 平台入口与带凭据的投递 |
| 应用状态、部署和日志 | 运行时注册、健康检查和重连 |
SDK 为开源项目,采用 MIT 许可证。CopilotKit Intelligence 可由 CopilotKit 托管,也可在企业部署中自行托管。
查看完整的 Channels 应用
OpenTag 是一个基于 Channels 构建的开源、自托管值班分诊助手。
你可以借此研究一个完整应用,其包括:
- 通过 AG-UI 连接的 Python LangGraph Agent
- 原生 Slack 和 Microsoft Teams 使用体验
- 感知文件的提示词与生成式 UI
- 在写入 Linear 或 Notion 前进行人工审批
- 具有生产形态的 Node 运行时和 Agent 服务
MIT © CopilotKit
English / 原文
channels-sdk.demo.mp4
Your agent keeps its tools, model, and business logic. Channels gives it a native place to work with people.
Your agent belongs where work happens
Channels connects an AG-UI-compatible agent to the communication platforms your team already uses. The agent can understand the conversation, stream a response, call tools, work with files, render interactive UI, and pause for human approval.
| Bring your agent | Render native UI | Keep people in control |
|---|---|---|
| Use CopilotKit's built-in agent or connect LangGraph, CrewAI, Mastra, Pydantic AI, Google ADK, and other AG-UI agents. | Describe a message once and render it as native Slack Block Kit, Teams Adaptive Cards, and platform-specific UI. | Put buttons, choices, and approval gates directly into the conversation before an agent acts. |
One interaction, native to every channel
| Slack | Microsoft Teams | Discord |
|---|---|---|
![]() |
![]() |
![]() |
Channels is built for a world where the same agent can meet users across every communication surface. Managed connections for Slack and Microsoft Teams are available through CopilotKit Intelligence, with more channels on the way.
Try it before you build it
Experience a real Channels agent in Slack or Microsoft Teams without configuring an app, runtime, or provider credentials.
Choose a platform, join the experience, and see how an agent handles context, tool use, and native channel UI.
Your agent and application logic run in your infrastructure. CopilotKit Intelligence manages the platform connection and delivers each turn to your long-running Channels process.
Fastest path: let your coding agent drive
Building a Channels agent spans a project, an agent, a managed Channel, a provider app, and a long-running runtime. One guide walks your agent through all of it.
npx copilotkit@latest channels setup
That installs the channels-setup skill, prints a prompt, and copies it to your clipboard. Paste it into your coding agent.
The skill is a pointer — it fetches the workflow from copilotkit.ai/channels-guide.md when your agent needs it, so the steps are current even if the installed skill is months old. The guide asks which platform you want, Slack or Microsoft Teams, and which agent framework.
Your agent drives the Slack and Intelligence consoles itself, in your own signed-in session. If it has no browser or computer-use tool yet, it will ask you to add one first — that is the intended path, not a fallback. You type the secrets; it does the clicking.
Or install the Slack setup skill on disk
Skip the hosted guide and put the Slack workflow directly in the coding agent you are already running in:
npx copilotkit@latest skills install --skill setup-slack-channel -y
-y installs that one skill without opening a picker. The skill is scoped to Slack — for Microsoft Teams, use the guide above.
The CLI covers the Intelligence side: copilotkit channels add --adapter slack declares the Channel and attaches the adapter, and copilotkit channels status compares your configuration, your code, and the server. What stays in the browser is the provider side — creating the Slack app and installing it into a workspace — plus issuing the project API key. No CLI flag accepts a credential value, so the bot token and signing secret stay in your .env and with you.
Unknown option '--skill'? An oldercopilotkit— globally installed or left in the npx cache — is shadowing the current CLI. Keep the@latest; that is what forces npx to fetch the current version instead of reusing what it already has.
The steps below are the same path, done by hand.
1. Configure the connection
Create a Channel in CopilotKit Intelligence and connect Slack. Keep the Channel Code and project-scoped Intelligence API key for the next steps.
You need Node.js 22 or later and a long-running Node process or container.
npm install @copilotkit/channels @copilotkit/runtime
npm install --save-dev tsx typescript @types/node
npm pkg set type=module
Channels and Runtime ship together as a tested pair. Upgrade both packages together.
The example below uses CopilotKit's built-in agent. Replace makeAgent with any AG-UI-compatible agent factory without changing the Channel lifecycle.
// 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",
name: "Channels Runtime",
}),
channels: [channel],
});
const listener = createCopilotNodeListener({
runtime,
basePath: "/api/copilotkit",
});
const channels = listener.channels;
if (!channels) throw new Error("Channels control surface was not created.");
const server = createServer(listener);
const shutdown = async () => {
await channels.stop();
if (server.listening) server.close();
};
process.once("SIGINT", shutdown);
process.once("SIGTERM", shutdown);
await channels.ready({ timeoutMs: 30_000 });
const status = channels.status();
if (status.overall !== "online") {
throw new Error(`Channel is not online: ${JSON.stringify(status)}`);
}
const port = Number(process.env.PORT ?? 3000);
server.listen(port, () => {
console.log(`Channel online; lifecycle server listening on :${port}`);
});
# .env
OPENAI_API_KEY=<openai-api-key>
INTELLIGENCE_API_KEY=<project-api-key>
CHANNEL_CODE=<channel-code-from-intelligence>
PORT=3000
node --env-file=.env --import tsx channel.ts
When Intelligence reports Online , invite the app to a Slack channel and mention it. Your agent now receives the conversation and responds in the thread.
Want Microsoft Teams, a different agent framework, interactive approvals, files, or production deployment guidance? Continue in the Channels documentation.
Rather have your agent do it? Run
npx copilotkit@latest channels setupfrom Fastest path above. The guide covers this same setup plus the provider and verification steps.
Every turn follows the same path:
- A person messages your app in Slack or Microsoft Teams.
- CopilotKit Intelligence receives the platform event and delivers it to your Channels process.
- Channels runs your agent over AG-UI, executes tools, and renders the result.
- Intelligence sends native platform UI back into the conversation.
| You run | CopilotKit Intelligence manages |
|---|---|
| Your agent, model credentials, tools, and business logic | Slack and Microsoft Teams platform credentials |
| The long-running Channels listener | Platform ingress and credentialed delivery |
| Application state, deployment, and logs | Runtime registration, health, and reconnects |
The SDK is open source and MIT licensed. CopilotKit Intelligence can be hosted by CopilotKit or self-hosted for enterprise deployments.
See a complete Channels app
OpenTag is an open-source, self-hosted on-call triage assistant built with Channels.
Use it to study a complete application with:
- a Python LangGraph agent connected over AG-UI
- native Slack and Microsoft Teams experiences
- file-aware prompts and generative UI
- human approval before Linear or Notion writes
- a production-shaped Node runtime and agent service
MIT © CopilotKit



