Repository navigation
Core ‐ Agent stop‐task
Bohdan Karpenko edited this page Apr 29, 2026
·
1 revision
This handler stops a running task managed by the system.
{
"type": "request",
"action": "stop-task",
"id": 1,
"data": {
"task_id": 123
}
}-
type: must be"request" -
action: must be"stop-task" -
id: request identifier -
data.task_id: integer (i64), required Identifier of the task that should be stopped
-
Validates that
dataexists -
Extracts
task_id -
Calls:
TaskManager::stop_task(task_id)
-
Stops execution of the specified task if it exists and is running
-
Returns success or structured error depending on task state
{
"type": "response",
"id": 1,
"status": "ok",
"code": 200,
"message": "Successfully stopped task."
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Missing data"
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Invalid stop-task request"
}Returned when the operation fails at runtime.
{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Failed to stop tasks",
"data": {
"error": "TaskNotFound"
}
}Possible error values:
-
FailedToRunTask— task execution failure -
TaskNotFound— task does not exist -
TaskAlreadyRunning— invalid state transition -
TaskAlreadyStopped— task is already stopped -
DatabaseError— DB operation failure -
FailedToPrepareEnvironment(String)— environment setup failed (with message) -
FailedToManageRun— runtime management failure
- This operation is idempotent only if the task is already stopped; otherwise it may return an error.
-
task_idmust be a valid signed 64-bit integer. - Error details from
TaskManagerare returned insidedata.erroras a string representation ofTaskError.