{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/axonflow/json-schema/axonflow-execution-snapshot-schema.json",
  "title": "ExecutionSnapshot",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/axonflow-decision-execution-replay-api-openapi.yml#/components/schemas/ExecutionSnapshot",
  "type": "object",
  "properties": {
    "request_id": {
      "type": "string"
    },
    "step_index": {
      "type": "integer"
    },
    "step_name": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "completed",
        "failed",
        "paused"
      ]
    },
    "started_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": "string",
      "format": "date-time"
    },
    "duration_ms": {
      "type": "integer"
    },
    "input": {
      "type": "object"
    },
    "output": {
      "type": "object"
    },
    "provider": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "tokens_in": {
      "type": "integer"
    },
    "tokens_out": {
      "type": "integer"
    },
    "cost_usd": {
      "type": "number",
      "format": "double"
    },
    "policies_checked": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "policies_triggered": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PolicyEvent"
      }
    },
    "error_message": {
      "type": "string"
    },
    "retry_count": {
      "type": "integer"
    },
    "approval_required": {
      "type": "boolean",
      "description": "True when this step gated on human approval. The pair\n`approved_at` + `approved_by` records when and by whom\nthe approval was granted (or shows null on rejection).\n"
    },
    "approved_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the approval-required gate was resolved. Pair with\n`approved_by` to compute approval latency at the step level.\n"
    },
    "approved_by": {
      "type": "string",
      "description": "User email of the approver. Empty when\n`approval_required` is false or the gate was auto-resolved.\n"
    }
  },
  "$defs": {
    "PolicyEvent": {
      "type": "object",
      "properties": {
        "policy_id": {
          "type": "string"
        },
        "policy_name": {
          "type": "string"
        },
        "action": {
          "type": "string",
          "enum": [
            "block",
            "warn",
            "require_approval"
          ]
        },
        "matched": {
          "type": "string"
        },
        "resolution": {
          "type": "string"
        }
      }
    }
  }
}