@@ -18,7 +18,7 @@ class Start_Agentflow implements INode {
1818 constructor ( ) {
1919 this . label = 'Start'
2020 this . name = 'startAgentflow'
21- this . version = 1.1
21+ this . version = 1.2
2222 this . type = 'Start'
2323 this . category = 'Agent Flows'
2424 this . description = 'Starting point of the agentflow'
@@ -40,6 +40,11 @@ class Start_Agentflow implements INode {
4040 label : 'Form Input' ,
4141 name : 'formInput' ,
4242 description : 'Start the workflow with form inputs'
43+ } ,
44+ {
45+ label : 'Schedule Input' ,
46+ name : 'scheduleInput' ,
47+ description : 'Start the workflow on a recurring schedule (cron)'
4348 }
4449 ] ,
4550 default : 'chatInput'
@@ -125,6 +130,135 @@ class Start_Agentflow implements INode {
125130 }
126131 ]
127132 } ,
133+ {
134+ label : 'Schedule Type' ,
135+ name : 'scheduleType' ,
136+ type : 'options' ,
137+ options : [
138+ {
139+ label : 'Visual Picker' ,
140+ name : 'visualPicker' ,
141+ description : 'Use a visual picker to select schedule options'
142+ } ,
143+ {
144+ label : 'Cron Expression' ,
145+ name : 'cronExpression' ,
146+ description : 'Use a cron expression to define the schedule'
147+ }
148+ ] ,
149+ show : {
150+ startInputType : 'scheduleInput'
151+ }
152+ } ,
153+ {
154+ label : 'Cron Expression' ,
155+ name : 'scheduleCronExpression' ,
156+ type : 'string' ,
157+ placeholder : '0 9 * * 1-5' ,
158+ description :
159+ 'Standard 5-field cron expression (minute hour day month weekday). Example: "0 9 * * 1-5" runs at 09:00 every weekday.' ,
160+ show : {
161+ startInputType : 'scheduleInput' ,
162+ scheduleType : 'cronExpression'
163+ }
164+ } ,
165+ {
166+ label : 'Frequency' ,
167+ name : 'scheduleFrequency' ,
168+ type : 'options' ,
169+ options : [
170+ {
171+ label : 'Hourly' ,
172+ name : 'hourly' ,
173+ description : 'Run every hour at the specified time'
174+ } ,
175+ {
176+ label : 'Daily' ,
177+ name : 'daily' ,
178+ description : 'Run every day at the specified time'
179+ } ,
180+ {
181+ label : 'Weekly' ,
182+ name : 'weekly' ,
183+ description : 'Run every week on the specified day and time'
184+ } ,
185+ {
186+ label : 'Monthly' ,
187+ name : 'monthly' ,
188+ description : 'Run every month on the specified date and time'
189+ }
190+ ] ,
191+ show : {
192+ startInputType : 'scheduleInput' ,
193+ scheduleType : 'visualPicker'
194+ }
195+ } ,
196+ {
197+ label : 'On Minute' ,
198+ name : 'scheduleOnMinute' ,
199+ type : 'number' ,
200+ placeholder : '30' ,
201+ description :
202+ 'Minute of the hour when the schedule should run (0-59). For example, "30" means the schedule will run at the 30th minute of the hour.' ,
203+ show : {
204+ startInputType : 'scheduleInput' ,
205+ scheduleType : 'visualPicker' ,
206+ scheduleFrequency : 'hourly'
207+ }
208+ } ,
209+ {
210+ label : 'On Time' ,
211+ name : 'scheduleOnTime' ,
212+ type : 'timePicker' ,
213+ show : {
214+ startInputType : 'scheduleInput' ,
215+ scheduleType : 'visualPicker' ,
216+ scheduleFrequency : [ 'daily' , 'weekly' , 'monthly' ]
217+ }
218+ } ,
219+ {
220+ label : 'On Day of Week' ,
221+ name : 'scheduleOnDayOfWeek' ,
222+ type : 'weekDaysPicker' ,
223+ show : {
224+ startInputType : 'scheduleInput' ,
225+ scheduleType : 'visualPicker' ,
226+ scheduleFrequency : 'weekly'
227+ }
228+ } ,
229+ {
230+ label : 'On Day of Month' ,
231+ name : 'scheduleOnDayOfMonth' ,
232+ type : 'monthDaysPicker' ,
233+ show : {
234+ startInputType : 'scheduleInput' ,
235+ scheduleType : 'visualPicker' ,
236+ scheduleFrequency : 'monthly'
237+ }
238+ } ,
239+ {
240+ label : 'Timezone' ,
241+ name : 'scheduleTimezone' ,
242+ type : 'string' ,
243+ placeholder : 'UTC' ,
244+ description : 'IANA timezone name, e.g. America/New_York. Defaults to UTC.' ,
245+ optional : true ,
246+ show : {
247+ startInputType : 'scheduleInput'
248+ }
249+ } ,
250+ {
251+ label : 'Default Input' ,
252+ name : 'scheduleDefaultInput' ,
253+ type : 'string' ,
254+ placeholder : 'Run the daily report' ,
255+ description : 'Default question/input passed to the flow when it is triggered by the scheduler.' ,
256+ acceptVariable : true ,
257+ rows : 4 ,
258+ show : {
259+ startInputType : 'scheduleInput'
260+ }
261+ } ,
128262 {
129263 label : 'Ephemeral Memory' ,
130264 name : 'startEphemeralMemory' ,
@@ -213,6 +347,14 @@ class Start_Agentflow implements INode {
213347 outputData . form = form
214348 }
215349
350+ if ( startInputType === 'scheduleInput' ) {
351+ const defaultInput = nodeData . inputs ?. scheduleDefaultInput as string
352+ const effectiveInput = ( typeof input === 'string' && input ) || defaultInput || ''
353+ inputData . question = effectiveInput
354+ outputData . question = effectiveInput
355+ outputData . scheduledAt = options . agentflowRuntime ?. scheduledAt ?? new Date ( ) . toISOString ( )
356+ }
357+
216358 if ( startEphemeralMemory ) {
217359 outputData . ephemeralMemory = true
218360 }
0 commit comments