What are Widgets?
Widgets are interactive UI components that your AI agent can display inline during conversations. Instead of responding with plain text, the agent renders rich elements — forms, cards, tables, charts, buttons, and more — directly in the chat. This lets your agent collect structured input, present data visually, and trigger actions, all without leaving the conversation.What You Can Do with Widgets
Collect Structured Input
Build forms with text inputs, dropdowns, date pickers, checkboxes, and other controls to gather data from users.
Display Rich Content
Show cards, tables, charts, images, and Markdown-formatted text to present information clearly.
Trigger Actions
Connect buttons and form submissions to API calls, chat messages, URL navigation, or data updates.
React to User Input
Use conditions to show, hide, or switch views based on the current values in the widget.
Import and Export
Share widgets across agents and teams by exporting and importing
.widget files.AI-Assisted Building
Generate widgets from natural language descriptions or start from pre-built templates.
Key Concepts
Understanding these core concepts will help you build and configure widgets effectively.| Concept | Description |
|---|---|
| Code | The visual layout of the widget, written using a built-in component library. |
| Schema | Defines the data fields the widget expects from the agent and their types. |
| Default Example | Initial values for all fields when the widget first renders. |
| Named Examples | Saved data presets for previewing different scenarios in the builder. |
| Functions | Actions attached to interactive elements that define what happens on interaction. |
| States | Named wrappers whose visibility is controlled by conditions based on current values. |
The Schema is how the agent knows what data to pass into the widget. Each field in the schema maps to a variable you can reference in the widget code.
Connecting Widgets to Actions
Widgets are always attached to an action. You create and manage widgets from within the Custom Action configuration page. When creating a custom action, select the Server with UI (Widget) or Widget only (UI only) action type to attach a widget. The action type determines how data flows into the widget. There are two types:- Widget-Only Actions
- Server Actions with Widgets
These actions have no API URL configured. The widget receives data directly from the action’s input fields.You can either sync inputs with the widget schema automatically or define them manually.Best suited for:
- Forms that collect user input
- Informational cards and menus
- Interactive elements that don’t need external data
Data Flow for Server Actions
Agent triggers the action
The AI agent decides to trigger the action and provides the required input data.
Response is merged with action input
The API response is combined with the original action input data. If both contain the same field, the API response takes priority.
Where Widget Data Comes From
When a widget renders, its data can come from multiple sources. Higher-priority sources override lower ones.| Priority | Source | Description |
|---|---|---|
| 1 (lowest) | Default example | The widget’s default values defined in the builder. |
| 2 | Action input | Data from the action’s configured input fields. |
| 3 (highest) | API response | Data returned from the API call (server actions only). |
If a field is present in both the action input and the API response, the API response value wins. Default example values are only used when no other source provides the field.
AI Response Transform
Sometimes the data returned by your API doesn’t match the widget’s schema exactly. The AI Response Transform uses AI to automatically map the API response fields to the widget’s expected schema.Import and Export
You can share widgets between agents, teams, or projects using.widget files.
Exporting a Widget
Exporting a Widget
- Open the widget in the builder.
- Click the more options menu (three dots) in the top-right corner.
- Select Export to download the widget as a
.widgetfile.
Importing a Widget
Importing a Widget
- Navigate to the Widgets list page.
- Click the Import button.
- Upload a
.widgetfile from your computer.