showcase/shell-docs/src/content/reference/bot/index.mdx
The bot stack turns any AG-UI agent into a chat-platform bot. Three packages, three jobs:
| Package | Role |
|---|---|
@copilotkit/bot | The platform-agnostic engine: createBot, handler registration, the agent run/tool/interrupt loop, and action binding. Re-exports the @copilotkit/bot-ui vocabulary. |
@copilotkit/bot-ui | A pure JSX runtime + cross-platform component vocabulary for rich messages — no React. |
@copilotkit/bot-slack | The Slack adapter: Socket Mode ingress, JSX → Block Kit via slack(), chat.update streaming. |
pnpm add @copilotkit/bot @copilotkit/bot-ui @copilotkit/bot-slack
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:
{
"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.
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.