{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://hai.ai/schemas/agent/v1/agent.schema.json",
  "title": "Agent",
  "description": "General schema for human, hybrid, and AI agents",
  "allOf": [
    {
      "$ref": "https://hai.ai/schemas/header/v1/header.schema.json"
    },
    {
      "type": "object",
      "properties": {
        "jacsAgentType": {
          "type": "string",
          "hai": "agent",
          "enum": [
            "human",
            "human-org",
            "hybrid",
            "ai"
          ],
          "description": "Type of the agent. 'human' indicates a biological entity, 'human-org' indicates a group of people, hybrid' indicates a combination of human and artificial components, 'ai' indicates a fully artificial intelligence."
        },
        "jacsAgentDomain": {
          "type": "string",
          "description": "Optional domain used for DNSSEC-validated public key fingerprint (_v1.agent.jacs.<domain>.)",
          "hai": "meta"
        },
        "jacsVerificationClaim": {
          "type": "string",
          "enum": [
            "unverified",
            "verified",
            "verified-registry",
            "verified-hai.ai"
          ],
          "default": "unverified",
          "description": "Agent's claim about verification status. 'unverified' (default) allows relaxed DNS/TLS settings. 'verified' requires strict DNS with DNSSEC and domain must be set. 'verified-registry' requires registry verification. DEPRECATED: 'verified-hai.ai' is a deprecated alias for 'verified-registry' and will be removed in the next major version.",
          "hai": "meta"
        },
        "jacsKeyRotationProof": {
          "type": "object",
          "description": "Cryptographic proof that a key rotation was authorized by the previous key holder. Present only on agent versions created by key rotation.",
          "properties": {
            "transitionMessage": {
              "type": "string",
              "description": "The transition message string: JACS_KEY_ROTATION:{agent_id}:{old_key_hash}:{new_key_hash}:{timestamp}"
            },
            "signature": {
              "type": "string",
              "description": "Base64-encoded signature of the transition message, created with the OLD private key"
            },
            "signingAlgorithm": {
              "type": "string",
              "description": "The cryptographic algorithm used to create the transition signature (the OLD key's algorithm)"
            },
            "oldPublicKeyHash": {
              "type": "string",
              "description": "SHA-256 hash of the old (pre-rotation) public key"
            },
            "newPublicKeyHash": {
              "type": "string",
              "description": "SHA-256 hash of the new (post-rotation) public key"
            },
            "timestamp": {
              "type": "string",
              "format": "date-time",
              "description": "ISO 8601 timestamp of the rotation event"
            }
          },
          "required": [
            "transitionMessage",
            "signature",
            "signingAlgorithm",
            "oldPublicKeyHash",
            "newPublicKeyHash",
            "timestamp"
          ]
        }
      },
      "jacsServices": {
        "type": "array",
        "minItems": 1,
        "description": "Services the agent can perform.",
        "items": {
          "$ref": "https://hai.ai/schemas/components/service/v1/service.schema.json"
        }
      },
      "jacsContacts": {
        "type": "array",
        "description": "Contact information for the agent",
        "items": {
          "$ref": "https://hai.ai/schemas/components/contact/v1/contact.schema.json"
        }
      }
    }
  ],
  "if": {
    "properties": {
      "jacsAgentType": {
        "type": "string",
        "enum": [
          "human",
          "human-org",
          "hybrid"
        ]
      }
    }
  },
  "then": {
    "properties": {
      "jacsContacts": {
        "minItems": 1
      }
    },
    "required": [
      "jacsContacts"
    ]
  },
  "required": [
    "jacsAgentType",
    "jacsServices"
  ]
}
