packages/ai exposes the Vercel Chat SDK through
@tuturuuu/ai/chat-sdk. Use it when a Tuturuuu agent needs to operate across
external channels and internal product surfaces with one normalized thread and
message contract.
The target workflow is:
Package Boundary
Import the Chat SDK boundary from:chat/ai tool helpers, then
adds Tuturuuu registry helpers for platform and state adapters.
Adapter Coverage
The adapter registry mirrors the Chat SDK adapter directory. Official platform adapters:- Slack:
@chat-adapter/slack - Microsoft Teams:
@chat-adapter/teams - Google Chat:
@chat-adapter/gchat - Discord:
@chat-adapter/discord - GitHub:
@chat-adapter/github - Linear:
@chat-adapter/linear - Telegram:
@chat-adapter/telegram - WhatsApp Business Cloud:
@chat-adapter/whatsapp - Messenger:
@chat-adapter/messenger - Web:
@chat-adapter/web
- Beeper Matrix:
@beeper/chat-adapter-matrix - Photon iMessage:
chat-adapter-imessage - Resend:
@resend/chat-sdk-adapter - Zernio:
@zernio/chat-sdk-adapter - Liveblocks:
@liveblocks/chat-sdk-adapter
- Webex:
@bitbasti/chat-adapter-webex - Baileys WhatsApp:
chat-adapter-baileys - Sendblue iMessage:
chat-adapter-sendblue - Blooio iMessage/RCS/SMS:
chat-adapter-blooio - Zalo:
chat-adapter-zalo - Mattermost:
chat-adapter-mattermost
- Memory:
@chat-adapter/state-memory - Redis:
@chat-adapter/state-redis - ioredis:
@chat-adapter/state-ioredis - PostgreSQL:
@chat-adapter/state-pg - Cloudflare Durable Objects:
chat-state-cloudflare-do - MySQL:
chat-state-mysql
Runtime Construction
Create a runtime by selecting only the adapters a route or worker owns. Passingtrue means the adapter should read credentials from its documented
environment variables. Passing an object forwards that object to the adapter
factory.
cloudflare:workers; load it only in a Cloudflare Workers runtime.
Agent Tools
Expose the selected chat runtime to AI SDK calls with Chat SDK tools:reader preset for analysis-only agents, messenger for normal
posting and DM workflows, and moderator for destructive operations such as
editing and deleting messages. Keep approval gates enabled by default for
visible writes unless the workflow has an explicit unattended execution policy.
External Chat Mirror
Apps/web AI agents mirror inbound and outbound Discord/Zalo messages through server-owned private RPCs. Runtime handlers persist webhook events as soon as they arrive, then persist any automatic or manual outbound response after the Chat SDK adapter accepts the post. When an operator clicks sync in Infrastructure > AI Agents, apps/web creates the configured Chat SDK runtime, opens the external thread handle, and consumes recentthread.messages when the adapter supports history fetch. Discord can
return recent messages with the right bot scopes. Official Zalo behaves as a
webhook-first adapter, so the mirror is populated by received events. Personal
Zalo channels use the experimental zca-js listener and can fetch group chat
history when the personal account session supports it.