You can use rich response widgets to create rich, interactive UI elements
for your user interface that utilizes the
[web widget deployment option](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/deploy/web-widget.md.txt).
When configuring this tool,
you provide a type (carousel, comparison, and so on)
and information about the widget schema.
When responding to queries,
the agent may decide to use this tool
and configuration to send widget data back to your client.
Your client then processes this data and presents the widget
in your user interface.
When your user makes a selection,
you send this information back to the agent.

### Create a rich response

> [!NOTE]
> **Note:** The current implementation of rich response widgets is built on [widget tools](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/tool/widget.md.txt). A future implementation will be stand alone, and will not require referencing a tool in agent instructions.

To create a widget tool:

1. Click the rich response widgets icon on the right side of the agent builder.
2. Click the **Add a widget** or **+** button to open the widget gallery.
3. Select a widget type template from the gallery, or click Custom widget in the header to create one from scratch.
4. Provide the requested information for the widget tool in the configuration panel
   - Name: A unique name for the widget tool.
   - Description: A description of what the tool does. This helps the agent's language model understand when to use this tool and how to populate the data.
   - Schema Preview / Parameters: For provided widget types, view the read-only JSON schema preview. If you selected a Custom widget, write your own JSON parameters to customize the widget's layout and elements.

### Use a widget in an agent

After creating a widget, you need to instruct a particular agent to use the widget.

- Hover over an agent.
- Click Add widget.
- Select the widget.
- Describe how the widget should be used in your agent instructions and reference the widget using the syntax: `{@Widget: widget_name}`.