logic.code component executes custom Python code safely within the workflow execution environment. It provides a sandboxed space equipped with helpers for input/output data handling and flow control.
Runtime Environment
The execution occurs inside a hardened Python 3 environment.Available Modules
You can leverage several standard libraries and helpful built-ins: Standard Libraries:json,uuid,time,datetime,zoneinfofunctools,traceback,copy,decimaltextwrap,math,re,abctyping,Union,Literal
ExceptionValueErrorExit: A special exception intentionally designed to exit the active code block immediately.
Input & Output
Reading Inputs
You can access data arriving at the component’s input ports. Inputs are received as explicitly typed Value Objects.data_inputs: A list of all received input port data.get_data_input(route): A helper function to grab the Value Object of a specific input port by its exact route name.
Writing Outputs
You can emit data out of the component by pushing Value Objects to output routes.set_data_output(route, value, persist=False): Assigns a value to a targeted output port.route: Output port name (e.g., “result”).value: The Value Object payload.persist: IfTrue, stores the output specifically to processor data tracking logic for external visibility.
Flow Control
You determine which logic route the workflow should navigate following code execution.set_result(route, terminal=False): Declares the destination route.route: Connection edge to traverse ("success","failure", etc).terminal: Set toTrueif this intentionally ends the entire workflow execution.
exit(): Aborts the execution of the remainder of the active code script.
Helper Functions
Data Helpers
create_message(role, text=None, attribute_id=None): Generates a standardized “message” Value Object dynamically.create_value(data_type, data): Quickly wrap arbitrary matching data into a recognized Value structure.
Session Management
Read or write semi-persistent object data retained to the execution’s parent session:download_session_object(alias)upload_session_object(alias, value)delete_session_object(alias)
Logging & Events
Produce informational, warning, or failure events logged to the execution stream:post_output_event(message)post_warning_event(message)post_error_event(message)
System Metadata
current_time_utc_iso(): Gets UTC time dynamically.result: The immediate runtime representation of the result dictionary.

