Repository navigation
Core ‐ Agent update‐task
Bohdan Karpenko edited this page Apr 2, 2026
·
1 revision
This handler updates an existing task in the system. It validates input data, applies changes in the database, and returns the updated task or an error.
{
"type": "request",
"action": "update-task",
"id": 1,
"data": {
"id": 123,
"name": "Task Name",
"description": "Task Description",
"install_script": "install.sh",
"run_script": "run.sh",
"delete_script": "delete.sh",
"restart_policy": "always"
}
}-
type: must be"request" -
action: must be"update-task" -
id: request identifier (mirrored in the response) -
data: object containing task fields:-
id— integer, task ID to update -
name— string, new task name -
description— string, new task description -
install_script— string, path or content of install script -
run_script— string, path or content of run script -
delete_script— string, path or content of delete script -
restart_policy— enum, one of:-
"no"— do not restart -
"always"— always restart -
"on-failure"— restart only on failure
-
-
- Validates that
dataexists and can be parsed intoUpdateTaskDTO - Updates task in the database by ID
- Returns the updated task in the response under
data.taskif successful
{
"type": "response",
"id": 1,
"status": "ok",
"code": 200,
"message": "Successfully updated task.",
"data": {
"task": {
"id": 123,
"core_id": 45,
"name": "Task Name",
"description": "Task Description",
"install_script": "install.sh",
"run_script": "run.sh",
"delete_script": "delete.sh",
"restart_policy": "always",
"status": "starting"
}
}
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Missing data"
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Invalid update-task request"
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Failed to update task"
}-
"ok"— task successfully updated -
"error"— request failed
- The
idin the response matches the requestid. - The
restart_policymust be one of"no","always","on-failure". - If the task does not exist or the database update fails, an error response is returned.
-
data.taskcontains the full task object after update.