{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-stuck-task-alert.schema.json",
  "title": "Agent Stuck Task Alert",
  "description": "Alert object for a task that has remained too long in a queue, evidence, callback, settlement, or replay state.",
  "type": "object",
  "required": [
    "object_type",
    "alert_id",
    "task_token",
    "current_lifecycle_state",
    "stuck_reason",
    "recommended_action",
    "created_at"
  ],
  "additionalProperties": true,
  "properties": {
    "object_type": {
      "type": "string",
      "const": "agent_stuck_task_alert"
    },
    "alert_id": {
      "type": "string"
    },
    "task_token": {
      "type": "string"
    },
    "requested_tool": {
      "type": "string"
    },
    "current_lifecycle_state": {
      "type": "string"
    },
    "stuck_reason": {
      "type": "string",
      "enum": [
        "missing_evidence",
        "queue_heartbeat_missed",
        "callback_delivery_failed",
        "credit_allocation_pending",
        "exception_open",
        "runner_error",
        "provider_settlement_pending",
        "manual_review_required"
      ]
    },
    "duration_minutes": {
      "type": "integer"
    },
    "recommended_action": {
      "type": "string"
    },
    "retry_command_url": {
      "type": "string",
      "format": "uri"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
