CopilotKitDocs
  • Docs
  • Reference
  • Cookbook
Get Intelligence free
CopilotKitDocs
DocsReferenceCookbook
DocsReferenceCookbook

@copilotkit/bot

ActionStoreBotNodeInteractionContext

@copilotkit/bot-slack

ReferencebotTypes

BotNode

The serializable intermediate representation (IR) of bot UI — what JSX renders to and what platform adapters translate.


Overview

BotNode is the intermediate representation between your JSX and a platform's native format. renderToIR lowers a component tree to BotNode[]; an adapter (e.g. slack()) translates those nodes to its native payload. Because the IR is plain serializable data, it can be snapshotted for action rehydration and asserted against in tests.

Shape

interface BotNode {
  type: string | ComponentFn | symbol; // intrinsic string after rendering
  props: Record<string, unknown>;
  key?: string | number;
}

type ComponentFn = (
  props: Record<string, unknown>,
) => BotNode | BotNode[] | string | null;

type Renderable = string | BotNode | BotNode[] | { raw: unknown };

Prop

Type

Prop

Type

Prop

Type

Special node types

  • text — strings and numbers in children become { type: "text", props: { value: string } }.
  • raw — the { raw } escape hatch passes through as { type: "raw", props: { value } }, letting you hand an adapter a native payload (e.g. hand-built Block Kit) without going through the vocabulary.

Children

type BotChildren =
  | BotNode
  | string
  | number
  | boolean
  | null
  | undefined
  | BotChildren[];

Conditionals render nothing (false / null / undefined), so {cond && <Section>…</Section>} works as expected.

Related

  • renderToIR — producing the IR
  • Message — the vocabulary that lowers to these nodes
  • ActionStore — how handler props are bound and snapshotted
10d3939