Skip to content

Core ‐ Agent remove‐task

Bohdan Karpenko edited this page Apr 1, 2026 · 1 revision

This handler is responsible for removing an existing task from the system. It validates input data, executes a database deletion, and returns the appropriate response.


Remove Task Request

Deletes a task by its unique identifier. The request requires the id field in the data object.

Request format

{
    "type": "request",
    "action": "remove-task",
    "id": 1,
    "data": {
        "id": 123
    }
}

Fields

  • type: must be "request"
  • action: must be "remove-task"
  • id: request identifier (mirrored in the response)
  • data.id: integer, required — the ID of the task to delete

Behavior

  • Validates that data is present and contains a valid id.
  • Executes a SQL DELETE query on the tasks table.
  • If deletion is successful (rows_affected == 1), returns a success response.
  • If deletion fails (missing data, invalid ID, or task not found), returns an error response.

Successful Response

{
    "type": "response",
    "id": 1,
    "status": "ok",
    "code": 200,
    "message": "Successfully deleted task 123"
}

Error Responses

Missing data field

{
    "type": "response",
    "id": 1,
    "status": "error",
    "code": 400,
    "message": "Missing data"
}

Invalid or missing id

{
    "type": "response",
    "id": 1,
    "status": "error",
    "code": 400,
    "message": "Failed to delete task, bad request"
}

Status Enum

  • "ok" — task deleted successfully
  • "error" — deletion failed or request invalid

Notes

  • Only a single task can be deleted per request.
  • id must correspond to an existing task; otherwise, the operation fails.
  • The database deletion is atomic: either the task is removed, or no changes occur.

Clone this wiki locally