Generate experiences with Puck AI
Read docs
CloudAISet up Puck AI

Set up Puck AI

Add the AI plugin to show a chat interface in the editor.

Via the CLI

npx @puckeditor/core add ai

Manual setup

First, get an API key and mount puckHandler() on your server, as described in Set up Cloud plugins. The plugin sends its requests there.

Install the plugin

Install the @puckeditor/plugin-ai package:

npm i @puckeditor/plugin-ai --save

Load the plugin

Load the plugin:

import { createAiPlugin } from "@puckeditor/plugin-ai";
 
const aiPlugin = createAiPlugin();
 
export function Editor() {
  return (
    <Puck
      plugins={[aiPlugin]}
      // ...
    />
  );
}

Your Puck editor should now show the “AI” plugin in the plugin bar on the left. Click it to present the chat interface.

Enter a prompt

You can now return to the Puck instance and enter a prompt. Here are some suggestions:

  • Hi. What can you do?
  • Create a page about dogs
  • Remove the heading block from the page

Puck AI will respond to your messages, and generate pages based on the available components in your Puck config.

Modes

By default, the agent runs in assembly mode, assembling pages from the components in your config. To let it create new component types on the fly, enable design mode.

Further reading