Start the agent for a project.
(
project_name: str,
request: AgentStartRequest = AgentStartRequest(),
)
| 89 | |
| 90 | @router.post("/start", response_model=AgentActionResponse) |
| 91 | async def start_agent( |
| 92 | project_name: str, |
| 93 | request: AgentStartRequest = AgentStartRequest(), |
| 94 | ): |
| 95 | """Start the agent for a project.""" |
| 96 | manager = get_project_manager(project_name) |
| 97 | |
| 98 | # Get defaults from global settings if not provided in request |
| 99 | default_yolo, default_model, default_testing_ratio, playwright_headless, default_batch_size = _get_settings_defaults() |
| 100 | |
| 101 | yolo_mode = request.yolo_mode if request.yolo_mode is not None else default_yolo |
| 102 | model = request.model if request.model else default_model |
| 103 | max_concurrency = request.max_concurrency or 1 |
| 104 | testing_agent_ratio = request.testing_agent_ratio if request.testing_agent_ratio is not None else default_testing_ratio |
| 105 | |
| 106 | batch_size = default_batch_size |
| 107 | |
| 108 | success, message = await manager.start( |
| 109 | yolo_mode=yolo_mode, |
| 110 | model=model, |
| 111 | max_concurrency=max_concurrency, |
| 112 | testing_agent_ratio=testing_agent_ratio, |
| 113 | playwright_headless=playwright_headless, |
| 114 | batch_size=batch_size, |
| 115 | ) |
| 116 | |
| 117 | # Notify scheduler of manual start (to prevent auto-stop during scheduled window) |
| 118 | if success: |
| 119 | from ..services.scheduler_service import get_scheduler |
| 120 | project_dir = _get_project_path(project_name) |
| 121 | if project_dir: |
| 122 | get_scheduler().notify_manual_start(project_name, project_dir) |
| 123 | |
| 124 | return AgentActionResponse( |
| 125 | success=success, |
| 126 | status=manager.status, |
| 127 | message=message, |
| 128 | ) |
| 129 | |
| 130 | |
| 131 | @router.post("/stop", response_model=AgentActionResponse) |
nothing calls this directly
no test coverage detected