| name | channels |
| description | Mastra agent channels (Slack, Discord, Telegram, etc.) via Chat SDK adapters. In this project, wrap agent tools with createAgentTools() and channel config with createAgentChannels() from ../shmastra; register agents on Mastra with storage for channel state. |
Agent channels (Mastra)
Mastra channels (since @mastra/core@1.22.0) connect agents to messaging platforms. Incoming messages run through the normal agent pipeline; replies stream back into the conversation.
Official docs:
When to use channels
Use them when the agent should respond in Slack, Discord, Telegram, or other supported platforms—DMs, mentions in threads, and group context (with sender labels and optional thread history prefetch).
Available channel adapters
How to add channels to agent
- Read channel-specific reference before starting (e.g.
telegram.md,)
- Install the adapter package (e.g.
@chat-adapter/telegram).
- Pass
channels on the Agent using Chat SDK adapter factories inside createAgentChannels.
Adapters typically read credentials from environment variables; see each adapter’s docs for setup.
Use createAgentChannels to wrap channels
Do not attach raw channels objects directly when defining agents in this codebase.
Always wrap the channel configuration with createAgentChannels from ../shmastra.
It applies shared handlers (attachments → stored files, reply formatting for Telegram, etc.) around the Chat SDK adapters.
Together, a channel-enabled agent should look like this:
import { Agent } from "@mastra/core/agent";
import { createTelegramAdapter } from "@chat-adapter/telegram";
import { createAgentChannels } from "../shmastra";
export const supportAgent = new Agent({
...
channels: createAgentChannels({
adapters: {
telegram: createTelegramAdapter({
botToken: process.env.SUPPORT_AGENT_TELEGRAM_BOT_TOKEN,
}),
},
}),
});