(self, **kwargs)
| 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", "") |
no test coverage detected