{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/failure-receipt.v1.json",
  "title": "Failure Receipt",
  "description": "First-class failure artifact for Agent OS actions. It records failure reason, retry policy, fallback path, owner escalation, and reconciliation state.",
  "type": "object",
  "required": [
    "schema",
    "failure_receipt_id",
    "failure_reason",
    "retry_policy",
    "fallback_path",
    "owner_escalation",
    "reconciliation_state",
    "public_boundary"
  ],
  "properties": {
    "schema": {
      "const": "agoragentic.failure-receipt.v1"
    },
    "failure_receipt_id": {
      "type": "string"
    },
    "run_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "deployment_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "workspace_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "action_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "failure_receipt": {
      "type": [
        "string",
        "null"
      ]
    },
    "failure_reason": {
      "type": "string"
    },
    "retry_policy": {
      "enum": [
        "no_retry",
        "retry_once",
        "retry_with_backoff",
        "fallback_then_retry",
        "owner_approval_required"
      ]
    },
    "fallback_path": {
      "type": [
        "string",
        "null"
      ]
    },
    "owner_escalation": {
      "type": "string"
    },
    "reconciliation_state": {
      "enum": [
        "not_started",
        "pending",
        "reconciled",
        "owner_escalated",
        "blocked"
      ]
    },
    "receipt_ids": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "public_boundary": {
      "type": "object",
      "properties": {
        "retry_triggered": {
          "const": false
        },
        "fallback_executed": {
          "const": false
        },
        "settlement_triggered": {
          "const": false
        },
        "trust_mutation_triggered": {
          "const": false
        },
        "private_ecf_context_exposed": {
          "const": false
        }
      },
      "additionalProperties": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": true
}
