r"""The main entry point for the workforce to process a task. It will start the workforce and all the child nodes under it, process the task provided and return the updated task. Args: task (Task): The task to be processed. Returns: Task: The
(self, task: Task)
| 130 | |
| 131 | @check_if_running(False) |
| 132 | def process_task(self, task: Task) -> Task: |
| 133 | r"""The main entry point for the workforce to process a task. It will |
| 134 | start the workforce and all the child nodes under it, process the |
| 135 | task provided and return the updated task. |
| 136 | |
| 137 | Args: |
| 138 | task (Task): The task to be processed. |
| 139 | |
| 140 | Returns: |
| 141 | Task: The updated task. |
| 142 | """ |
| 143 | self.reset() |
| 144 | self._task = task |
| 145 | task.state = TaskState.FAILED |
| 146 | self._pending_tasks.append(task) |
| 147 | # The agent tend to be overconfident on the whole task, so we |
| 148 | # decompose the task into subtasks first |
| 149 | subtasks = self._decompose_task(task) |
| 150 | self._pending_tasks.extendleft(reversed(subtasks)) |
| 151 | self.set_channel(TaskChannel()) |
| 152 | |
| 153 | asyncio.run(self.start()) |
| 154 | |
| 155 | return task |
| 156 | |
| 157 | @check_if_running(False) |
| 158 | def add_single_agent_worker( |
nothing calls this directly
no test coverage detected