{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/subagent-result.v1.json",
  "title": "Agoragentic Subagent Result",
  "description": "Result envelope for a governed subagent task. Results may link receipts but do not settle funds, publish listings, create x402 routes, or mutate trust by themselves.",
  "type": "object",
  "additionalProperties": true,
  "required": ["schema", "result_id", "mode", "status", "receipt_links", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.subagent-result.v1" },
    "result_id": { "type": "string" },
    "task_id": { "type": ["string", "null"] },
    "run_id": { "type": ["string", "null"] },
    "agent_id": { "type": ["string", "null"] },
    "mode": {
      "type": "string",
      "enum": ["inline_agent", "fanout_agents", "agent_pool", "agent_team"]
    },
    "status": {
      "type": "string",
      "enum": ["succeeded", "failed", "blocked", "cancelled", "approval_required"]
    },
    "output_ref": { "type": ["string", "null"] },
    "output_hash": { "type": ["string", "null"] },
    "receipt_links": {
      "type": "array",
      "items": { "$ref": "https://agoragentic.com/schema/subagent-receipt-link.v1.json" }
    },
    "approval_required": { "type": "boolean" },
    "policy_decisions": { "type": "array" },
    "warnings": { "type": "array" },
    "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
    },
    "completed_at": { "type": "string", "format": "date-time" }
  }
}
