Bots

API reference for the CopilotKit bot stack — @copilotkit/bot, @copilotkit/bot-ui, @copilotkit/bot-slack, and @copilotkit/bot-discord.


The bot stack turns any AG-UI agent into a chat-platform bot. Three packages, three jobs:

PackageRole
@copilotkit/botThe platform-agnostic engine: createBot, handler registration, the agent run/tool/interrupt loop, and action binding. Re-exports the @copilotkit/bot-ui vocabulary.
@copilotkit/bot-uiA pure JSX runtime + cross-platform component vocabulary for rich messages — no React.
@copilotkit/bot-slackThe Slack adapter: Socket Mode ingress, JSX → Block Kit via slack(), chat.update streaming.
@copilotkit/bot-discordDiscord PlatformAdapter for @copilotkit/bot: Gateway ingress via discord.js, Components V2 egress, streaming replies, and slash-command registration.
pnpm add @copilotkit/bot @copilotkit/bot-ui @copilotkit/bot-slack
# or, for Discord:
pnpm add @copilotkit/bot @copilotkit/bot-ui @copilotkit/bot-discord

New to the stack? Start with the Slack quickstart — zero to a working bot, then come back here for the API surface.

Join the waitlist for managed Slack and Teams agents
The APIs below let you own the adapter, runtime, platform credentials, tools, and storage. Join the waitlist if you want CopilotKit Intelligence to manage Slack and Teams rollout, identity, durable state, approvals, observability, and release workflows.
Join the waitlist

Setup

The packages ship as ES modules only ("type": "module" required). To author messages as JSX, point the TypeScript JSX factory at @copilotkit/bot-ui and write .tsx files:

tsconfig.json
{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@copilotkit/bot-ui"
  }
}

The package ships its own JSX namespace via @copilotkit/bot-ui/jsx-runtime, so JSX is statically type-checked: unknown attributes, wrong prop values, and bad children are compile-time errors.

Start here

How the pieces fit

A turn flows through three stages. The adapter normalizes a platform event into a turn and hands it to your handler, which calls thread.runAgent(). The engine drives the run loop — streaming text into the thread, executing tools when the agent calls them, capturing interrupts. Anything you post is JSX lowered to the BotNode intermediate representation (plain serializable data), which the adapter translates to the platform's native format — with interactive handlers bound through the ActionStore.

Related