JavaScript functions
Small reusable operations with explicit inputs and outputs.
#The function contract
Create a Function under Tools. Declared inputs arrive in args.inputVars. Values returned in outputVars are written to conversation variables. Declare outputs so they are visible in the editor.

- 1Type: function
- 2Add
#An example with no external request
export default async function main(args) {
const name = String(args.inputVars.name ?? '').trim();
return { outputVars: { normalized_name: name } };
}#Execution and testing
Test a normal value and an empty input. Check the returned variables and selected path. The Function editor limits execution time to 30 seconds; API tools have a separate setting. For branching, return next.path and connect the corresponding canvas output.