Configuration Guide
Detailed configuration guide for the XMPro Meta Action Agent, including setup code, parameter definitions and recommended settings for optimal integration in data streams.
This guide explains how to configure the XMPro Meta Action Agent for seamless integration, detailing each parameter and its recommended use for script execution.
General
Collection
This associates the Agent to a specific Collection (defaults to that of the current Data Stream).
Universal ID
c7da0c81-2795-4fa4-9c63-d79647cd810f
Setup Code
The data stream must be republished to pick up any changes to the source code - whether in Git or entered manually.
Language
The Source Code's programming language, options are:
Python
Ensure any software required to run source code for this language is installed on your Stream Host device.
Execution Timeout (seconds)
The duration in seconds when executing the Source Code functions before it throws a timeout error. The default value is 60 seconds.
This ensures that when an unknown problem occurred, or the function took too long to execute than expected, it won't cause any deadlock on the Data Stream, and it could just continue with a timeout error.
Use Git Repository
Tick to use a Git Repository as the Source Code and README of the configuration.
Git Repository
Click to open the Git Repository Configuration (applies only if Use Git Repository is ticked.
Source Code
Click to open the Source Code configuration.
README
Click to open the README configuration.
Git Repository
This link opens a sub-page that allows you to reference a Git Repository to be used as the Source Code and README of the Agent. When configured, this retrieves the files from latest commit of the selected Branch. Using a Git Repository allows the user to use a whole project instead of just one file for the Source Code. The configured Main Source Code still needs to contain the Source Code Functions, and any dependencies needed should be installed on the Stream Host environment.
When running the Data Stream, the Git Repository is temporarily cloned on the Stream Host environment during publishing, so it is not advisable to store any confidential data on the Repository.
Use Variables
Tick to use variables for the Git Repository configs.
Repository URL
The URL to the Git Repository.
Use Authentication
Tick to use Authentication when the Git Repository is not Public.
Username
The Username for accessing a Private Git Repository (applies only when Use Authentication is ticked).
Password
The Password or Personal Access Token for accessing a Private Git Repository (applies only when Use Authentication is ticked).
Branch
The Branch of the Git Repository to retrieve the files from.
Main Source Code Path
The Path to the main Source Code that contains the implemented Source Code Functions. This will be used as the main script that the Agent will run. When configured, it retrieves the contents of file and assigned to the value of Source Code script box.
README Path
The Path to the README file. When configured, it retrieves the contents of file and assigned to the value of README script box.
Source Code
This link opens a sub-page that allows you to input your Source Code. A working example is provided by default.
If Use Git Repository is ticked, only the Source Code is displayed and shows the contents of the configured Main Source Code Path. Any changes will not be saved and will always show the latest contents from the Git Repository.
Validate Package
Click to check whether the Stream Host has all packages used by your Source Code. When Use Git Repository is ticked, packages are checked against those in the requirements.txt. The whole repository is validated if there is no requirements.txt file. Note: The python module pipreqs is a pre-requisite to validate packages.
Source Code
The code you want to run, defaults to a sample. See Source Code Functions for the functions that must be implemented. Source Code is unique for each Stream Object's configuration (i.e. each time the Agent is added to a canvas).
README
This link opens a sub-page where you can enter the documentation as Markdown that describes how your Agent works. This aids other users to understand what your Agent does and how it works. A default README describing the default Source Code is provided by default.
If Use Git Repository is ticked, it shows the latest contents of the configured README Path, and any changes will not be saved.
README
An introduction and guide for users and contributors. By default, a sample readme is provided. The readme supports the Markdown syntax.
Export Agent
This configuration allows you to export a new Agent Package using the current configurations of the Agent. You can then import this new Agent Package with the fixed functionality, input definitions and payload definition.
Export Agent Package
Click to open the Export Agent Package configuration.
Export Agent Package
Input all the details of the new Agent Package to be exported.
Existing Agent
Tick to show the Id input and specify an existing Agent Id. This also gets ticked after clicking Package Agent to show the current Id of the new Agent.
Id
The Universal Id of an existing Agent (applies only when Existing Agent is ticked). If the inputted Id is not an existing Agent when imported to the Data Stream, it is treated as a new Agent. The value should be a valid GUID.
Name
The name of the Packaged Agent.
Category
The Category of the Packaged Agent. The options are the existing Agent categories: Listeners, Context Providers, Transformations, AI & Machine Learning, Functions, Recommendations, and Action Agents
Description
The description of the Packaged Agent.
Version
The version of the Packaged Agent. Exporting with an input on the Id and upgrading the Version allows you to import the agent as a newer version of an existing one.
Icon
The icon of the Packaged Agent.
Package Agent
Click to create the Agent Package.
Download Agent
The download link for the Agent Package. Click to download the file. This will only show after clicking the Package Agent.
Using the Exported Agent Package
To use the exported Agent, import it just like any Agent on the Data Stream Agents tab. Use the new Agent on a Data Stream and open to configure it. The following configs from Meta Action Agent are displayed on the new Agent and some configs needs to be updated before running the Agent.
Setup Code
Execution Timeout
Update to adjust the Execution Timeout of the Agent. Defaults to the configuration before it was exported.
Setup Code
README
Click to View the README of the Agent. This should not be updated, and any changes will not be saved.
On Create
Input Definition
Update the On Create Input Definition. The properties are fixed but how the value is assigned could be changed.
On Receive
Input Definition
Update the On Receive Input Definition. The properties are fixed but how the value is assigned could be changed.
Output Payload
Payload Definition
The properties are fixed and should not be updated. Any changes on this config will not be saved.
On Create
This is used to map the input for the on_create function and is run once when the data stream is published. It is well suited for passing in static configuration and functionality that only needs to be run once.
Input Definition
Input values for the data parameter of the On Create function of the source code:
Name: This is the property name you will use to reference the Value from your Source Code.
Source: The source of the value, the options are Manual and Variable.
Encrypt: Tick to encrypt the inputted Value (applies only when Source is Manual). When encrypted, the user will not be able to see the actual value on the configuration and allows you use credentials or passwords in a safe and secure manner.
Value: The value of the input. Input the value if source is Manual or select from the Server Variables if source is Variable.
Note: Re-enter your Value when changing the Encrypt configuration.
On Receive
This is used to map the input for the on_receive function and is run for each incoming payload. This is well suited for passing in dynamic values and process those values to get results.
Input Definition
Input values for the data parameter of the On Receive function of the source code:
Name: This is the property name you will use to reference the Value from your Source Code.
Source: The source of the value, the options are Manual, Variable, and Payload.
Encrypt: Tick to encrypt the inputted Value (applies only when Source is Manual). When encrypted, the user will not be able to see the actual value on the configuration and allows you use credentials or passwords in a safe and secure manner.
Value: The value of the input. Input the value if source is Manual, select from the Server Variables if source is Variable, or Select from the Parent outputs if Source is Payload.
Note: Re-enter your Value when changing the Encrypt configuration.
Process as Batch
Tick to process the incoming payload of Events as a batch. See Source Code Functions on how to handle Events as a batch on the source code level. Note: This is helpful if each batch from the incoming payload contains multiple Events, and you want to aggregate their values or process all of them at once.
Output
Define the expected output payload of the Agent. This should also match the properties for the output of the on_receive function.
Output Definition
Expected output values of the On Receive function. The values are then published on the Output Endpoint:
Name: This text must match the desired property key in the returned dictionary or for each item in the list of dictionaries.
Type: The data type of the output value. The options are String, Integer, Double, Long, Boolean, and DateTime.
Include Columns from Input Payload
Tick to append columns from the input payload (applies when Process as Batch is unticked).
Input Payload Columns
Select the input payload columns to include in the output payload (applies when Include Columns from Input Payload is ticked). Leave blank to include the whole input payload. Notes:
The output value overwrite the Input Payload if it contains a property with the same name.
If the
on_receivefunction returns a list instead of a single object, the selected Input Payload is added to each item on the list.
Log Standard Outputs
Tick to include Standard Outputs from your Source Code like print() in the Stream Host log. Unticked by default to avoid filling the logs.
Endpoints
Input
This endpoint is used to receive data from the parent Agent and map the values to the On Receive Input Definition.
Output
Events received from the parent Agent are processed and the output is made available to this endpoint with attributes as specified in the Output section.
Error
Errors on the Source Code and the running Process are made available on this endpoint.
Source Code Functions
The following functions must be implemented for the Source Code to run. Each function corresponds to an Agent lifecycle and the Input and Output definitions needs to be configured:
on_create
Run once when the data stream is published. Ideal for handling static configuration and long running initialization of services to improve overall performance.
data: dict - dictionary data type. Contains values from On Create Input Definition with Name as the property name.
A dictionary or nothing. The output is primarily used for debugging purposes and any output is visible in the SH logs.
on_receive
Run for each event received from the parent Agent. Ideal for handling dynamic values to be processed for each event.
The incoming data contains mapped values from On Receive Input Definition with Name as the property name. It could either be a:
data: dict - individual data for each Event from the incoming payload.
data: list[dict] - becomes a list if Process as Batch is ticked. This contains all the Events received from the incoming payload.
A dictionary dict or a list of dictionaries list[dict].
The output should correspond to a column Name in the Output Payload and it becomes available on the Output Endpoint.
When returning a list[dict], the items are automatically outputted as a Batch of Events on the output payload.
on_destroy
Run when the data stream is unpublished. Ideal for cleaning up any resources used.
None
A dictionary or nothing. The output is primarily used for debugging purposes and any output is visible in the SH logs.
Last updated
Was this helpful?