Widget
Last updated
Last updated
Widgets in UPTIQ AI Workbench are modular UI components that enhance the functionality of AI agents by embedding custom interactive elements. They allow developers to create custom interfaces that integrate seamlessly within agent workflows, enabling enhanced interactivity, data visualization, and workflow automation.
A widget in UPTIQ AI Workbench is a reusable web component that extends the capabilities of AI agents. It can be a simple UI element like a button or a complex component that interacts with backend workflows, listens to events, and processes user input.
Creation: Developers create widgets using React, Tailwind CSS, and Shadcn UI.
Exporting: Widgets are converted into web components using @r2wc/react-to-web-component
.
Hosting: Built widget bundles are hosted and linked in the agent configuration.
Integration: The widget is embedded within the agent’s UI and interacts with workflows.
Event Listening & Execution: Widgets can listen to custom events and trigger workflows accordingly.
It is mandatory to use only the following libraries/packages to develop a component:
React -
Shadcn UI -
Tailwind CSS -
@r2wc/react-to-web-component - for converting React components to web components -
Node.js and Yarn installed
Basic knowledge of React and web components
Access to the UPTIQ AI Workbench
Install dependencies
The entry point for widgets is src/index.ts
. This file exports all widgets as web components.
Create a new file: src/widgets/secondWidget/SecondWidget.tsx
.
Add a React component:
Create an index.ts
inside src/widgets/secondWidget/
for better organization:
Update src/index.ts
to register the new widget:
Build the project:
Host the dist/
folder bundle in the cloud.
Use dist/index.js
in the AI Workbench as a script:
Navigate to the Widgets tab in the AI Agent config page.
Click on Add Custom Widget.
Fill in the required details:
Name: Widget name
Description: Short description
Events: Custom events for workflow interactions
HTML Content: Include the script to load the widget
Click Save.
Approve the widget and toggle it on for use.
Use useSamuelEventListener
to listen for custom events:
Call the workflow execution API:
Update src/development/constants.ts
with test values.
Modify index.html
to include the widget:
Start the local development server:
Following these steps, developers can create, configure, and integrate custom widgets into the UPTIQ AI Workbench to enhance AI agent capabilities.
Download the starter project from custom-widget-starter
Want to learn more? Check the for a full list of supported events and how to configure them in your workflow. 🚀