Build a widget with the AI widget builder
Describe a widget in plain language and let the AI widget builder create its components, states and functions, then refine it with follow-up requests.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
The AI widget builder turns a description into a working widget. You say what the customer should see and do, and the builder creates the components, states and functions. Use it for a first version, then refine it with more instructions or in the code editor.
Create a widget with a description
- Open your agent and go to Actions > Widgets.
- Select New widget, then Describe with AI.
- Write what the widget should show and do, and select Generate.
- Review the preview on the right.
- Select Save when it looks right.
You should see a live preview built from sample data, with a list of the components, states and functions it created.
A useful description names the data, the layout and the actions:
Show an order tracking card. At the top, the order number and a status badge. Below, a timeline of shipping events. At the bottom, a button "Contact support" that sends the message "I need help with this order". Load the order with the order lookup action using the order number the agent passes in.
Refine with follow-up requests
Keep talking to the builder after the first draft. Each request changes the widget and updates the preview.
- "Show the estimated delivery date under the badge."
- "Make the button secondary and add a link to the return policy."
- "If the order is not found, show a short message instead of an empty card."
Ask for one change at a time. Small requests are easier to check, and you can undo a request from the history list.
Preview with sample data
The preview uses sample values so you can check the layout without a real order. Switch Preview data to edit the sample object, or select Empty to see how the widget looks before data loads. See States for how data is stored.
Tell the agent when to use it
Write the When to show field in plain language, for example: "When the customer asks where their order is and an order number is known." The agent reads this together with your procedures.
Go further
- Open the Code tab to see the definition the builder wrote. You can edit it by hand and return to the builder afterward.
- Connect data with an action. A widget loads data through a
callActionstep, described in Functions. - Check the result in the Playground.
Note: Generated changes go into a draft. Customers see them only after you publish the agent version. See Versions.
Related pages
The widgets overview explains the parts every widget has.