r"""Generate subtasks based on the previous task results and incomplete task list. Args: task_list (List[str]): The completed or in-progress tasks which should not overlap with new created tasks. Returns: List[str]: The new task list
(
self,
task_list: List[str],
)
| 275 | ) |
| 276 | |
| 277 | def run( |
| 278 | self, |
| 279 | task_list: List[str], |
| 280 | ) -> List[str]: |
| 281 | r"""Generate subtasks based on the previous task results and |
| 282 | incomplete task list. |
| 283 | |
| 284 | Args: |
| 285 | task_list (List[str]): The completed or in-progress |
| 286 | tasks which should not overlap with new created tasks. |
| 287 | |
| 288 | Returns: |
| 289 | List[str]: The new task list generated by the Agent. |
| 290 | """ |
| 291 | |
| 292 | if len(task_list) > 0: |
| 293 | task_creation_prompt = self.task_creation_prompt.format( |
| 294 | task_list=task_list |
| 295 | ) |
| 296 | else: |
| 297 | task_creation_prompt = self.task_creation_prompt.format( |
| 298 | task_list="" |
| 299 | ) |
| 300 | |
| 301 | task_msg = BaseMessage.make_user_message( |
| 302 | role_name="Task Creator", content=task_creation_prompt |
| 303 | ) |
| 304 | task_response = self.step(task_msg) |
| 305 | |
| 306 | if task_response.terminated: |
| 307 | raise RuntimeError("Task creation failed.") |
| 308 | if len(task_response.msgs) == 0: |
| 309 | raise RuntimeError("Got no task creation message.") |
| 310 | |
| 311 | sub_tasks_msg = task_response.msgs[0] |
| 312 | return get_task_list(sub_tasks_msg.content) |
| 313 | |
| 314 | |
| 315 | @track_agent(name="TaskPrioritizationAgent") |
nothing calls this directly
no test coverage detected