@@ -126,6 +126,10 @@ class ScheduledTaskInput(BaseModel):
126126 distilled_future_task_instructions : str = Field (
127127 ..., description = "Distilled and detailed instructions about how the task will be processed in future"
128128 )
129+ future_handle_alias : HandlerAlias | None = Field (
130+ None ,
131+ description = "The specific email handle (e.g., 'news', 'summarize') to use for the future task. Defaults to 'ask' if not provided." ,
132+ )
129133 start_time : str | None = Field (
130134 None , description = "Start time for the task - task will not execute before this time (ISO format)"
131135 )
@@ -185,6 +189,11 @@ class ScheduledTasksTool(Tool):
185189 "type" : "string" ,
186190 "description" : "Distilled and detailed instructions about how the task will be processed in future" ,
187191 },
192+ "future_handle_alias" : {
193+ "type" : "string" ,
194+ "description" : "The specific email handle (e.g., 'news', 'summarize') to use for the future task. Defaults to 'ask' if omitted." ,
195+ "nullable" : True ,
196+ },
188197 "start_time" : {
189198 "type" : "string" ,
190199 "description" : "Optional start time for the task in ISO 8601 format - task will not execute before this time" ,
@@ -215,6 +224,7 @@ def forward(
215224 self ,
216225 cron_expression : str ,
217226 distilled_future_task_instructions : str ,
227+ future_handle_alias : str | None = None ,
218228 start_time : str | None = None ,
219229 end_time : str | None = None ,
220230 ) -> dict :
@@ -224,6 +234,7 @@ def forward(
224234 Args:
225235 cron_expression: Valid cron expression for task scheduling
226236 distilled_future_task_instructions: Distilled and detailed instructions about how the task will be processed in future
237+ future_handle_alias: The specific email handle to use for the future task.
227238 start_time: Optional start time for the task in ISO 8601 format
228239 end_time: Optional end time for the task in ISO 8601 format
229240
@@ -233,6 +244,7 @@ def forward(
233244 """
234245 logger .info (f"Storing and scheduling task: { distilled_future_task_instructions } " )
235246 logger .info (f"Cron expression: { cron_expression } " )
247+ logger .info (f"Future handle alias: { future_handle_alias } " )
236248 logger .info (f"Is one-time task: { is_one_time_task (cron_expression ) if cron_expression else 'Unknown' } " )
237249
238250 # Get email request from context
@@ -253,6 +265,7 @@ def forward(
253265 input_data = ScheduledTaskInput (
254266 cron_expression = cron_expression ,
255267 distilled_future_task_instructions = distilled_future_task_instructions ,
268+ future_handle_alias = future_handle_alias ,
256269 start_time = start_time ,
257270 end_time = end_time ,
258271 )
@@ -306,8 +319,16 @@ def forward(
306319 # Save distilled instructions and task description to email request
307320 email_request .distilled_processing_instructions = input_data .distilled_future_task_instructions
308321 email_request .task_description = distilled_future_task_instructions
309- # TODO: Need an AI driver logic here but for now we'll just redirect to ask
310- email_request .distilled_alias = HandlerAlias .ASK
322+ if input_data .future_handle_alias :
323+ try :
324+ email_request .distilled_alias = HandlerAlias (input_data .future_handle_alias )
325+ logger .info (f"Using specified handle alias: { input_data .future_handle_alias } " )
326+ except ValueError :
327+ logger .warning (f"Invalid handle alias '{ input_data .future_handle_alias } ', defaulting to ASK" )
328+ email_request .distilled_alias = HandlerAlias .ASK
329+ else :
330+ email_request .distilled_alias = HandlerAlias .ASK
331+
311332 email_request .parent_message_id = email_request .messageId
312333
313334 # Store task in database using CRUD
0 commit comments