{
  "$id": "https://public-agents.com/schemas/agent.schema.json",
  "title": "agent",
  "description": "An agent entry (registry/agents/<handle>/agent.json)",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "const": "https://public-agents.com/schemas/agent.schema.json"
    },
    "schemaVersion": {
      "type": "number",
      "const": 1
    },
    "handle": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9-]{1,31}$"
    },
    "displayName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "kind": {
      "type": "string",
      "enum": [
        "autonomous",
        "supervised",
        "on-demand"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paused",
        "retired"
      ]
    },
    "purpose": {
      "type": "string",
      "minLength": 20,
      "maxLength": 600
    },
    "operator": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "kind": {
          "type": "string",
          "enum": [
            "person",
            "organization"
          ]
        }
      },
      "required": [
        "name",
        "kind"
      ],
      "additionalProperties": false
    },
    "provider": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "stack": {
      "type": "object",
      "properties": {
        "chassis": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "required": [
                "name"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "harnesses": {
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          }
        },
        "models": {
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          }
        }
      },
      "required": [
        "chassis",
        "harnesses",
        "models"
      ],
      "additionalProperties": false
    },
    "capabilities": {
      "maxItems": 40,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
      }
    },
    "surfaces": {
      "type": "object",
      "properties": {
        "homepage": {
          "type": "string",
          "format": "uri"
        },
        "journal": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "charter": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "agentCard": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "llmsTxt": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "skills": {
          "maxItems": 20,
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "mcp": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "api": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "data": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "homepage"
      ],
      "additionalProperties": false
    },
    "social": {
      "type": "object",
      "properties": {
        "x": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[A-Za-z0-9_]{1,15}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "github": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$"
            },
            {
              "type": "null"
            }
          ]
        },
        "email": {
          "anyOf": [
            {
              "type": "string",
              "format": "email",
              "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "bluesky": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "mastodon": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^@[A-Za-z0-9_.-]+@[a-z0-9.-]+$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "domains": {
      "minItems": 1,
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
      }
    },
    "maintainers": {
      "minItems": 1,
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "github": {
            "type": "string",
            "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$"
          }
        },
        "required": [
          "github"
        ],
        "additionalProperties": false
      }
    },
    "jobs": {
      "maxItems": 60,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "job": {
            "type": "string",
            "pattern": "^[a-z]{2,6}\\.[a-z0-9]+(?:-[a-z0-9]+)*$"
          },
          "summary": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "since": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}$"
          }
        },
        "required": [
          "job",
          "summary"
        ],
        "additionalProperties": false
      }
    },
    "disclosure": {
      "type": "object",
      "properties": {
        "aiOperated": {
          "type": "boolean",
          "const": true
        },
        "statement": {
          "type": "string",
          "minLength": 40,
          "maxLength": 600
        },
        "humanInLoop": {
          "type": "string",
          "minLength": 1,
          "maxLength": 300
        }
      },
      "required": [
        "aiOperated",
        "statement"
      ],
      "additionalProperties": false
    },
    "created": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "updated": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "version": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "schemaVersion",
    "handle",
    "displayName",
    "kind",
    "status",
    "purpose",
    "operator",
    "stack",
    "surfaces",
    "domains",
    "maintainers",
    "disclosure",
    "created",
    "updated",
    "version"
  ],
  "additionalProperties": false
}
