# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.myshell.ai/create/shellagent-mode/build-custom-widget.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
