Plugins
What is a Plugin?
A plugin is essentially a manually coded Compute Node.
When writing a Compute Node, there are often scenarios where you need to reuse already written Compute Nodes. Plugins were introduced to solve this problem. You can encapsulate commonly used functionalities into plugins and call them directly when needed.
Creating a Plugin
There are two ways to create a plugin:
Directly from a Compute Node
In the agent editing page, right-click on a Compute Node and select Create Plugin to directly create a plugin.
Note: Only manually coded Compute Nodes can be turned into plugins.From "My Plugins"
In the Plugin Marketplace / My Plugins page, click Create Plugin to create a plugin.
Plugin Attributes
Plugin attributes include:
- Plugin name
- Plugin description
- Programming language of the plugin
Plugin Source Code and Input Parameters
You can write or modify the source code of a plugin in My Plugins. The source code of a plugin is no different from a manually coded Compute Node. The only consideration is that the logic should be more abstract and generalized so that different agents can call it.
The input parameters of a plugin refer to any variables referenced in the source code using the format {{parameter_name}}. When an agent calls the plugin, it needs to provide values for these parameters in the plugin's property panel.
You can input fixed values or reference other variables in the agent using {{variable_name}}.
If the plugin's input parameters are not configured, the agent will first try to reference the variable with the same name in the agent's context. For example, if a plugin's input parameter is named myName
, and no value is configured for it in the plugin node, but the agent's context has a myName
variable, the agent will directly use the value of myName
. If the agent's context does not have a myName
variable, the parameter's value will be set to N/A
.
Publishing a Plugin
After writing a plugin, you can click Publish to release it to the Plugin Marketplace for yourself or others to use. When publishing a plugin, you need to provide the following information:
- Visibility:
- Tenant-wide: All users in the tenant can use it.
- User-only: The plugin can only be used by you.
- Open Source: If open-sourced, other users can view the plugin's source code. Note: If the plugin's code contains sensitive information (e.g., API keys, database connection strings), it is recommended not to open-source it.
- Icon: You can upload a custom icon for the plugin.
- Plugin Tags: You can add tags to the plugin to help users identify it.
- Input Parameter Descriptions: Provide explanations for the plugin's input parameters to help users understand what values to provide when calling the plugin.
- Optional: If an input parameter is optional, users can omit it when calling the plugin. In this case, the parameter's value will be
N/A
. Note: The plugin's logic should handle this scenario.
- Optional: If an input parameter is optional, users can omit it when calling the plugin. In this case, the parameter's value will be
- Output Result Descriptions: Explain the plugin's output results to help users process the results in subsequent nodes.
Plugin Marketplace
Published plugins appear in the Plugin Marketplace. Clicking on a plugin card allows you to view its detailed description and manually call the plugin. If the plugin is open-sourced, you can also view its source code.