> For the complete documentation index, see [llms.txt](https://docs.myshell.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.myshell.ai/create/shellagent-mode/build-custom-widget.md).

# Build Custom Widget

## Development

### Example

Reference code:

<https://github.com/wl-zhao/proconfig-diffuser-imagen>

The code above provides a simple example of calling the `DiffusionPipeline` in diffusers. The core code is in:

<https://github.com/wl-zhao/proconfig-diffuser-imagen/blob/main/diffuser_widget.py>

### Development Process

1. Define the widget's name and category through `NAME` and `CATEGORY`.
2. Define input and output specifications via `InputsSchema` and `OutputsSchema`. Use pydantic syntax to define the schema for each field.
3. Implement the `execute` function to define the widget's actual execution logic. The function's inputs and outputs need to meet the previously defined input and output specifications.
4. In the root directory, define `__init__.py` (e.g., <https://github.com/wl-zhao/proconfig-diffuser-imagen/blob/main/**init**.py>), and import the written widget inside.

## Usage

You can install it via **Install from Git** in the Manager.

<figure><img src="/files/rGf1eLm2ne4ZvhztEbnU" alt=""><figcaption></figcaption></figure>
