MCPcopy
hub / github.com/agent0ai/agent-zero / create_planned_task

Method create_planned_task

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

Source from the content-addressed store, hash-verified

368 return Response(message=f"Adhoc task '{name}' created: {task.uuid}", break_loop=False)
369
370 async def create_planned_task(self, **kwargs) -> Response:
371 name: str = kwargs.get("name", "")
372 system_prompt: str = kwargs.get("system_prompt", "")
373 prompt: str = kwargs.get("prompt", "")
374 attachments: list[str] = kwargs.get("attachments", [])
375 plan: list[str] = kwargs.get("plan", [])
376 dedicated_context: bool = kwargs.get("dedicated_context", True)
377
378 # Convert plan to list of datetimes in UTC
379 task_plan, err = _task_plan_from_input(plan)
380 if err:
381 return Response(message=err, break_loop=False)
382
383 project_slug, project_color = self._resolve_project_metadata()
384
385 # Create planned task with task plan
386 task = PlannedTask.create(
387 name=name,
388 system_prompt=system_prompt,
389 prompt=prompt,
390 attachments=attachments,
391 plan=task_plan,
392 context_id=None if dedicated_context else self.agent.context.id,
393 project_name=project_slug,
394 project_color=project_color
395 )
396 await TaskScheduler.get().add_task(task)
397 return Response(message=f"Planned task '{name}' created: {task.uuid}", break_loop=False)
398
399 async def wait_for_task(self, **kwargs) -> Response:
400 task_uuid: str = kwargs.get("uuid", "")

Callers 1

executeMethod · 0.95

Calls 6

ResponseClass · 0.90
_task_plan_from_inputFunction · 0.85
getMethod · 0.45
createMethod · 0.45
add_taskMethod · 0.45

Tested by

no test coverage detected