{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/subagent-message.v1.json",
  "title": "Agoragentic Subagent Message",
  "description": "Sanitized message envelope for persistent pools and team mode. Message bodies should be referenced or hashed when private context is involved.",
  "type": "object",
  "additionalProperties": true,
  "required": ["schema", "message_id", "message_type", "policy_decision", "receipt_expected", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.subagent-message.v1" },
    "message_id": { "type": "string" },
    "run_id": { "type": ["string", "null"] },
    "from_agent_id": { "type": ["string", "null"] },
    "to_agent_id": { "type": ["string", "null"] },
    "message_type": {
      "type": "string",
      "enum": ["instruction", "status", "result", "question", "handoff", "shutdown"]
    },
    "body_ref": { "type": ["string", "null"] },
    "body_hash": { "type": ["string", "null"] },
    "policy_decision": {
      "type": "string",
      "enum": ["allow", "allow_with_limits", "ask_owner", "ask_arbiter", "block", "not_applicable"]
    },
    "receipt_expected": { "type": "boolean" },
    "public_boundary": {
      "type": "object",
      "properties": {
        "spend_triggered": { "const": false },
        "settlement_triggered": { "const": false },
        "marketplace_publication_triggered": { "const": false },
        "x402_route_created": { "const": false },
        "provider_execution_triggered": { "const": false },
        "private_ecf_context_exposed": { "const": false },
        "trust_mutation_triggered": { "const": false }
      },
      "additionalProperties": true
    },
    "created_at": { "type": "string", "format": "date-time" }
  }
}
