MCPcopy Index your code
hub / github.com/agent0ai/agent-zero / run_task

Method run_task

tools/scheduler.py:207–220  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

205 return Response(message=json.dumps(serialize_task(task), indent=4), break_loop=False)
206
207 async def run_task(self, **kwargs) -> Response:
208 task_uuid: str = kwargs.get("uuid", "")
209 if not task_uuid:
210 return Response(message="Task UUID is required", break_loop=False)
211 task_context: str | None = kwargs.get("context", None)
212 task: ScheduledTask | AdHocTask | PlannedTask | None = TaskScheduler.get().get_task_by_uuid(task_uuid)
213 if not task:
214 return Response(message=f"Task not found: {task_uuid}", break_loop=False)
215 await TaskScheduler.get().run_task_by_uuid(task_uuid, task_context)
216 if task.context_id == self.agent.context.id:
217 break_loop = True # break loop if task is running in the same context, otherwise it would start two conversations in one window
218 else:
219 break_loop = False
220 return Response(message=f"Task started: {task_uuid}", break_loop=break_loop)
221
222 async def delete_task(self, **kwargs) -> Response:
223 task_uuid: str = kwargs.get("uuid", "")

Callers 1

executeMethod · 0.95

Calls 4

ResponseClass · 0.90
run_task_by_uuidMethod · 0.80
getMethod · 0.45
get_task_by_uuidMethod · 0.45

Tested by

no test coverage detected