{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "task.schema.json",
  "title": "tar.a2a task",
  "description": "JSON-only task record for protocol tar.a2a version 1.0. One state machine only. SQLAlchemy is not part of the contract.",
  "type": "object",
  "additionalProperties": true,
  "required": ["task_id", "requester", "requested_capability", "status"],
  "properties": {
    "task_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Unique per registry. Duplicate create with the same task_id is HTTP 409."
    },
    "requester": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Requesting agent id."
    },
    "assignee": {
      "type": ["string", "null"],
      "maxLength": 128,
      "description": "Assigned agent id, if any."
    },
    "requested_capability": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "description": {
      "type": "string",
      "maxLength": 8000
    },
    "status": {
      "type": "string",
      "enum": [
        "requested",
        "accepted",
        "rejected",
        "in_progress",
        "completed",
        "failed",
        "verified",
        "disputed"
      ],
      "description": "Only these states. Do not invent a second state machine."
    },
    "protocol": {
      "type": "string",
      "maxLength": 64,
      "default": "http"
    },
    "result": {
      "description": "Submitted result JSON, if any. A completed task with a result is not the same as a true answer.",
      "type": ["object", "null"],
      "additionalProperties": true
    },
    "created_at": {
      "type": "string",
      "description": "ISO-8601 timestamp."
    },
    "updated_at": {
      "type": "string",
      "description": "ISO-8601 timestamp."
    }
  }
}
