{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agenticrail-nz/json-schema/agenticrail-nz-evaluate-request-schema.json",
  "title": "EvaluateRequest",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agenticrail-nz-openapi.json#/components/schemas/EvaluateRequest",
  "type": "object",
  "required": [
    "sequence_id",
    "step",
    "action_type"
  ],
  "properties": {
    "sequence_id": {
      "type": "string",
      "description": "Stable identifier for this run. All steps of one sequence share it."
    },
    "step": {
      "type": "string",
      "description": "The step being attempted. Must equal `function`."
    },
    "function": {
      "type": "string",
      "description": "Optional; defaults to `step`. If sent, must equal `step` (else `FUNCTION_STEP_MISMATCH`)."
    },
    "action_type": {
      "type": "string",
      "description": "What kind of action this is. Each function permits a specific set.",
      "enum": [
        "CHECK_STATE",
        "SELECT_NEXT_STEP",
        "PAUSE_CYCLE",
        "RECORD_RESULT"
      ]
    },
    "action": {
      "type": "string",
      "description": "Human-readable label for the action. Recorded, not enforced."
    },
    "inputs": {
      "type": "object",
      "description": "Optional step inputs. Screened for prompt-injection patterns before enforcement. NEVER stored in the receipt: the receipt carries only `payload_hash`, a SHA-256 of the whole request. Use `attestation` for anything that must be kept as evidence.",
      "additionalProperties": true
    },
    "nonce": {
      "type": "string",
      "format": "uuid",
      "description": "Optional; generated by the gate if absent. If sent, unique per step: reuse is refused with `REPLAY_NONCE`."
    },
    "ts_ms": {
      "type": "integer",
      "description": "Optional. Caller's timestamp, epoch milliseconds. If sent, refused with `STALE_TIMESTAMP` when more than 300 seconds from server time in either direction. If absent, the gate's own clock is used and the freshness check is skipped."
    },
    "step_order": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Optional, but send it on every call, identical each time, for your own process. The sequence's declared step order; one step is a valid sequence. It is LOCKED on the sequence's first permitted call (a refused call locks nothing): a different list later is refused `STEP_ORDER_MISMATCH` and the refusal returns `locked_step_order`. Omit to use the default MSMD spine: intake, disruption, instability, state_read, internal_driver, execution, boundary, settle. Not an array, or empty: 400."
    },
    "attestation": {
      "type": "object",
      "description": "Required for a `RECORD_RESULT` at the `boundary` step. Binds the recorded result to a specific prior receipt.",
      "properties": {
        "witnessed_pack_id": {
          "type": "string",
          "description": "Must equal the last ALLOWED, durably-written receipt's `pack_id`, which is then re-fetched and re-checked. Mismatch is refused with `ARTIFACT_UNBOUND`."
        }
      }
    }
  }
}