{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentic-os.local/schemas/agent-message.json",
  "title": "AgentMessage",
  "type": "object",
  "required": ["schema_version", "message_id", "correlation_id", "from_agent", "payload"],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0"
    },
    "message_id": {
      "type": "string",
      "format": "uuid"
    },
    "correlation_id": {
      "type": "string",
      "description": "Temporal workflow run id or trace id"
    },
    "thread_id": {
      "type": "string",
      "description": "LangGraph thread / checkpoint namespace"
    },
    "from_agent": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
    },
    "to_agent": {
      "type": ["string", "null"],
      "pattern": "^[a-z0-9-]+$"
    },
    "kind": {
      "type": "string",
      "enum": ["task", "result", "error", "approval_request", "approval_response"]
    },
    "payload": {
      "type": "object",
      "additionalProperties": true
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": false
}
