Create Plugins#

This how-to explains how to build Plugins in Dioptra. You will learn how to create a plugin container, add code to it, and register tasks.

Prerequisites#

Plugin Creation Workflow#

Follow these steps to create and register a new plugin. You can perform these actions via the Guided User Interface (GUI) or programmatically using the Python Client.

Step 1: Prepare your Python Code#

Write your Python functions or Artifact classes in a local file. Ensure you have applied the necessary decorators or class inheritance.

Step 2: Create the Plugin Container#

First, define the container that will hold your files.

In the Dioptra GUI, navigate to the Plugins tab. Click CREATE. Enter a name and description, then click SUBMIT.

Step 3: Create a Plugin File#

Next, add your Python code to the container.

Click into your newly created Plugin. Within the Plugin container, click the “Create” button in the Plugin Files window.

In the Plugin file editor, provide a filename, a description, and paste or upload your Python code (from Step 1) into the code editor.

Step 4: Register Tasks (GUI only)#

Finally, register the tasks so they are visible to Dioptra.

Use the Task Form on the right side of the file editor:

  • For Functions: Click “Import Function Tasks” to auto-detect and register decorated functions (requires type annotations in Python code). Alternatively, register tasks manually:

    • Task Name: Must match the Python Function Name exactly.

    • Input Params: Add parameters matching your function arguments exactly.

    • Output Params: Define names for the returned values.

  • For Artifacts: You must manually register the task.

    • Task Name: Must match the Python Class Name exactly.

    • Output Params: Select the Parameter Type that corresponds to the object produced by the deserialize method.

All inputs and outputs require a Parameter Type for validation. See Plugin Parameter Types for more.

Step 5: Save and Confirm (GUI only)#

Once the tasks appear in the list (GUI) or the API call returns successfully (Python Client), your plugin is ready for use in experiments.

See Also#