{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentqueryprotocol.com/specification/2026-07-30/schema/query-response.schema.json",
  "title": "AQP QueryResponse",
  "description": "A policy-controlled answer bound to one query and subject.",
  "type": "object",
  "additionalProperties": false,
  "required": ["protocolVersion", "responseId", "queryId", "subject", "respondent", "answer", "createdAt"],
  "properties": {
    "protocolVersion": { "const": "2026-07-30" },
    "responseId": { "type": "string", "format": "uuid" },
    "queryId": { "type": "string", "format": "uuid" },
    "subject": { "$ref": "query-subject.schema.json" },
    "respondent": {
      "type": "object",
      "additionalProperties": false,
      "required": ["kind"],
      "properties": {
        "kind": { "enum": ["agent", "human", "service", "automated_system"] },
        "id": { "type": "string", "minLength": 1, "maxLength": 256 },
        "provenance": { "enum": ["direct", "inferred", "delegated", "automated"] }
      }
    },
    "answer": {
      "description": "The answer value. It MUST satisfy the response contract declared by the corresponding QueryRequest."
    },
    "explanation": { "type": "string", "minLength": 1, "maxLength": 4000 },
    "confidence": { "type": "number", "minimum": 0, "maximum": 1 },
    "consent": { "$ref": "consent-attestation.schema.json" },
    "supersedesResponseId": { "type": "string", "format": "uuid" },
    "createdAt": { "type": "string", "format": "date-time" }
  }
}
