A drop-in ⌘K palette with built-in AI that can actually do things in your app. Search commands, chat with AI, approve actions — one interface.
Define actions once. They become searchable commands and AI tools — automatically.
Step 1
Declare what your app can do. Each action gets a name, parameters, and an execute function. Actions serve double duty — they appear as searchable commands and as AI tools.
Step 2
Pass an ExternalChat object from modifywithai.com, Vercel AI SDK, or your own backend. Your actions become AI tools automatically — no extra config.
Step 3
Actions show up as fuzzy-searchable commands. Or users type natural language and the AI picks the right action to run.
Pass a chat prop with the ExternalChat interface and you're done. Your provider sends messages, streams responses, and passes available actions — better-cmdk handles the UI.
One component. One provider. Actions that work as both commands and AI tools.
// 1. Define actions — they become both commands and AI tools
const actions = [
{
name: "updateTheme",
label: "Change app theme",
options: { theme: { type: "string", required: true } },
execute: (opts) => setTheme(opts.theme),
},
];
// 2. Connect any provider
<CommandMenu chat={provider} open={open} onOpenChange={setOpen}>
{({ mode }) => (
<>
<CommandInput placeholder="Search or ask AI..." />
<CommandList actions={actions}>
{mode === "command" && (
<CommandGroup heading="Navigation">
<CommandItem>Dashboard</CommandItem>
<CommandItem>Settings</CommandItem>
</CommandGroup>
)}
</CommandList>
</>
)}
</CommandMenu>Give your users the command palette they've been waiting for. Search, chat, and act — all from ⌘K.