{
  "$defs": {
    "BranchDecision": {
      "description": "Why a branch went one way: the condition, its value and the values it read.",
      "examples": [
        {
          "arm": "then",
          "condition": "nodes.adf.p_value >= params.alpha or nodes.kpss.reject",
          "decided_at": "2026-10-15T09:30:00Z",
          "explain_plain": "The tests found that the series wanders and does not return to a steady level. The workflow applied a difference.",
          "inputs": {
            "nodes.adf.p_value": 0.57,
            "nodes.kpss.reject": true,
            "params.alpha": 0.05
          },
          "node_id": "wanders",
          "value": true
        }
      ],
      "properties": {
        "arm": {
          "enum": [
            "then",
            "else"
          ],
          "title": "Arm",
          "type": "string"
        },
        "condition": {
          "title": "Condition",
          "type": "string"
        },
        "decided_at": {
          "format": "date-time",
          "title": "Decided At",
          "type": "string"
        },
        "explain_plain": {
          "anyOf": [
            {
              "maxLength": 300,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "What the path taken means, in plain words (the branch's explain_then or explain_else); none when the branch has no explanation",
          "title": "Explain Plain"
        },
        "inputs": {
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          },
          "description": "Each reference in the condition -> its value",
          "title": "Inputs",
          "type": "object"
        },
        "node_id": {
          "title": "Node Id",
          "type": "string"
        },
        "value": {
          "title": "Value",
          "type": "boolean"
        }
      },
      "required": [
        "node_id",
        "condition",
        "value",
        "arm",
        "decided_at"
      ],
      "title": "BranchDecision",
      "type": "object"
    },
    "ErrorCode": {
      "description": "Stable error codes. See :data:`ERROR_INFO` for HTTP status and titles.",
      "enum": [
        "SCHEMA_INVALID",
        "SPEC_PARSE_ERROR",
        "PAYLOAD_TOO_LARGE",
        "UNSUPPORTED_API_VERSION",
        "REF_UNRESOLVED",
        "SETTINGS_INVALID",
        "BINDING_INVALID",
        "SPLIT_INVALID",
        "LEAKAGE_RISK",
        "DIM_POLICY_LOOSENED",
        "SCHEMA_DYNAMIC",
        "SIDE_TABLE_COVERAGE",
        "PLOT_UNSAFE",
        "UNSEEN_LEVELS",
        "COORD_NOT_ALLOWED",
        "HORIZON_EXCEEDS_FIT",
        "MISSING_FUTURE_COVARIATE",
        "NON_CONTIGUOUS_EXTENSION",
        "CAPABILITY_UNSUPPORTED",
        "RECURSIVE_UNSUPPORTED",
        "MODE_NOT_SUPPORTED",
        "QUOTA_EXCEEDED",
        "RATE_LIMITED",
        "UNAUTHENTICATED",
        "FORBIDDEN",
        "NOT_FOUND",
        "CONFLICT",
        "IDEMPOTENCY_CONFLICT",
        "PRECONDITION_FAILED",
        "USER_CODE_ERROR",
        "RESOURCE_EXHAUSTED",
        "INFRA_ERROR",
        "INTEGRITY_FAILURE",
        "TIMEOUT",
        "SANDBOX_VIOLATION",
        "CANCELLED",
        "INTERNAL_ERROR",
        "GUIDED_ANSWERS_INVALID",
        "BUSINESS_PRIORS_INVALID",
        "CALIBRATION_UNSUPPORTED",
        "IMPORT_UNSUPPORTED",
        "SCENARIO_OUT_OF_RANGE",
        "PROMOTION_BLOCKED",
        "OVERRIDE_REQUIRED",
        "WEBHOOK_URL_BLOCKED",
        "WEBHOOK_SIGNATURE_INVALID",
        "EMBED_NOT_ALLOWED",
        "LINK_EXPIRED",
        "EMAIL_NOT_ALLOWED",
        "TERMS_NOT_ACCEPTED",
        "EMAIL_NOT_VERIFIED",
        "IDENTITY_VERIFICATION_REQUIRED",
        "ABOUT_INCOMPLETE",
        "CHOOSER_ANSWER_INVALID",
        "WORKFLOW_INVALID",
        "EXPRESSION_INVALID",
        "EXPRESSION_ERROR",
        "NODE_UNKNOWN",
        "SCHEDULE_INVALID",
        "WORKFLOW_NOT_RUNNABLE",
        "POLICY_INVALID",
        "VALIDATION_TRANSITION_INVALID",
        "SELF_APPROVAL_FORBIDDEN",
        "NOT_VALIDATED",
        "EXPLORE_INVALID",
        "OPTIMIZE_INFEASIBLE",
        "ACTUALS_NOT_SUPPORTED",
        "ACTUALS_INVALID",
        "NOT_READY",
        "INGEST_UNSAFE_FILE"
      ],
      "title": "ErrorCode",
      "type": "string"
    },
    "JsonValue": {},
    "NodeError": {
      "properties": {
        "code": {
          "$ref": "#/$defs/ErrorCode"
        },
        "message": {
          "maxLength": 2000,
          "title": "Message",
          "type": "string"
        },
        "untrusted_text": {
          "anyOf": [
            {
              "maxLength": 8000,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Untrusted Text"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "title": "NodeError",
      "type": "object"
    },
    "NodeKind": {
      "enum": [
        "test",
        "transform",
        "branch",
        "split",
        "search",
        "model",
        "evaluate",
        "compare",
        "select",
        "governance",
        "report",
        "plot",
        "subworkflow"
      ],
      "title": "NodeKind",
      "type": "string"
    },
    "NodeOutputRef": {
      "description": "Where a node output lives: a reference (``dataset://``, ``model://``), a run artifact\n(``run_id`` + ``object``) or, for small JSON payloads (test results, split plans,\nmetrics), ``inline``.",
      "properties": {
        "inline": {
          "$ref": "#/$defs/JsonValue",
          "default": null
        },
        "object": {
          "anyOf": [
            {
              "maxLength": 256,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Object"
        },
        "ref": {
          "anyOf": [
            {
              "maxLength": 512,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Ref"
        },
        "run_id": {
          "anyOf": [
            {
              "examples": [
                "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
              ],
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Run Id"
        },
        "type": {
          "$ref": "#/$defs/PortType"
        }
      },
      "required": [
        "type"
      ],
      "title": "NodeOutputRef",
      "type": "object"
    },
    "NodeRun": {
      "description": "One node of a workflow run.",
      "examples": [
        {
          "attempt": 1,
          "cache_key": "sha256:5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a",
          "finished_at": "2026-10-15T09:30:04Z",
          "kind": "test",
          "node_id": "adf",
          "outputs": {
            "result": {
              "inline": {
                "test": "test.adf"
              },
              "type": "test_result"
            }
          },
          "params": {
            "alpha": 0.05,
            "regression": "c"
          },
          "result": {
            "decision": "unit_root",
            "p_value": 0.57,
            "reject": false,
            "statistic": -1.42
          },
          "run_id": "run_01jaf3q2x8m9v7k5h4g3f2e1d0",
          "started_at": "2026-10-15T09:30:00Z",
          "status": "succeeded",
          "use": "test.adf@1.0.0"
        }
      ],
      "properties": {
        "attempt": {
          "default": 0,
          "minimum": 0,
          "title": "Attempt",
          "type": "integer"
        },
        "cache_key": {
          "anyOf": [
            {
              "pattern": "^sha256:[0-9a-f]{64}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Cache Key"
        },
        "cached_from": {
          "anyOf": [
            {
              "examples": [
                "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
              ],
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Workflow run whose result was reused",
          "title": "Cached From"
        },
        "child_runs": {
          "description": "Fits and other children",
          "items": {
            "examples": [
              "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
            ],
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
            "type": "string"
          },
          "title": "Child Runs",
          "type": "array"
        },
        "cost": {
          "anyOf": [
            {
              "$ref": "#/$defs/RunCost"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "error": {
          "anyOf": [
            {
              "$ref": "#/$defs/NodeError"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "finished_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Finished At"
        },
        "kind": {
          "$ref": "#/$defs/NodeKind"
        },
        "node_id": {
          "title": "Node Id",
          "type": "string"
        },
        "outputs": {
          "additionalProperties": {
            "$ref": "#/$defs/NodeOutputRef"
          },
          "title": "Outputs",
          "type": "object"
        },
        "params": {
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          },
          "description": "Resolved params",
          "title": "Params",
          "type": "object"
        },
        "result": {
          "anyOf": [
            {
              "additionalProperties": {
                "$ref": "#/$defs/JsonValue"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "JSON result conditions read (nodes.<id>.<field>)",
          "title": "Result"
        },
        "run_id": {
          "anyOf": [
            {
              "examples": [
                "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
              ],
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The workflow_node run that executed it",
          "title": "Run Id"
        },
        "skipped_reason": {
          "anyOf": [
            {
              "maxLength": 500,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Skipped Reason"
        },
        "started_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Started At"
        },
        "status": {
          "$ref": "#/$defs/NodeRunStatus"
        },
        "use": {
          "description": "Resolved implementation ref (id@version)",
          "title": "Use",
          "type": "string"
        }
      },
      "required": [
        "node_id",
        "use",
        "kind",
        "status"
      ],
      "title": "NodeRun",
      "type": "object"
    },
    "NodeRunStatus": {
      "enum": [
        "pending",
        "queued",
        "running",
        "succeeded",
        "cached",
        "skipped",
        "failed",
        "cancelled"
      ],
      "title": "NodeRunStatus",
      "type": "string"
    },
    "PortType": {
      "description": "What flows along a workflow edge.",
      "enum": [
        "dataset",
        "test_result",
        "split_plan",
        "model_version",
        "metrics",
        "table",
        "plot",
        "report",
        "evidence"
      ],
      "title": "PortType",
      "type": "string"
    },
    "RunCost": {
      "description": "Cost of a run (all attempts). ``estimated`` is true until an ``actual`` ledger entry\nexists; ``usd`` is kept for v0.2 clients and is set only when the currency is USD.",
      "examples": [
        {
          "estimated": true,
          "gib_seconds": null,
          "usd": null,
          "vcpu_seconds": null
        },
        {
          "amount_micros": 31200,
          "attempts_billed": 1,
          "currency": "USD",
          "estimate_micros": 30000,
          "estimated": false,
          "gib_seconds": 4800,
          "price_version": "cloudrun-list-2026-10",
          "usd": 0.0312,
          "vcpu_seconds": 1200
        }
      ],
      "properties": {
        "amount_micros": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Amount Micros"
        },
        "attempts_billed": {
          "default": 0,
          "minimum": 0,
          "title": "Attempts Billed",
          "type": "integer"
        },
        "currency": {
          "anyOf": [
            {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Currency"
        },
        "estimate_micros": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Pre-run estimate",
          "title": "Estimate Micros"
        },
        "estimated": {
          "default": true,
          "title": "Estimated",
          "type": "boolean"
        },
        "gib_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Gib Seconds"
        },
        "price_version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Price Version"
        },
        "usd": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Usd"
        },
        "vcpu_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Vcpu Seconds"
        }
      },
      "title": "RunCost",
      "type": "object"
    },
    "WorkflowRunStatus": {
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "cancelling",
        "cancelled"
      ],
      "title": "WorkflowRunStatus",
      "type": "string"
    },
    "WorkflowTriggerEvent": {
      "enum": [
        "manual",
        "schedule",
        "dataset.version.created",
        "parent",
        "validation"
      ],
      "title": "WorkflowTriggerEvent",
      "type": "string"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/api-WorkflowRun.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "``GET /v1/workflow-runs/{run_id}``: a run of a workflow revision with every node.",
  "examples": [
    {
      "created_at": "2026-10-15T09:30:00Z",
      "decisions": [
        {
          "arm": "then",
          "condition": "nodes.adf.p_value >= params.alpha or nodes.kpss.reject",
          "decided_at": "2026-10-15T09:30:00Z",
          "explain_plain": "The tests found that the series wanders and does not return to a steady level. The workflow applied a difference.",
          "inputs": {
            "nodes.adf.p_value": 0.57,
            "nodes.kpss.reject": true,
            "params.alpha": 0.05
          },
          "node_id": "wanders",
          "value": true
        }
      ],
      "inputs": {
        "data": "dataset://growth/weekly_sales@v4"
      },
      "nodes": [
        {
          "attempt": 1,
          "cache_key": "sha256:5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a",
          "finished_at": "2026-10-15T09:30:04Z",
          "kind": "test",
          "node_id": "adf",
          "outputs": {
            "result": {
              "inline": {
                "test": "test.adf"
              },
              "type": "test_result"
            }
          },
          "params": {
            "alpha": 0.05,
            "regression": "c"
          },
          "result": {
            "decision": "unit_root",
            "p_value": 0.57,
            "reject": false,
            "statistic": -1.42
          },
          "run_id": "run_01jaf3q2x8m9v7k5h4g3f2e1d0",
          "started_at": "2026-10-15T09:30:00Z",
          "status": "succeeded",
          "use": "test.adf@1.0.0"
        }
      ],
      "params": {
        "alpha": 0.05
      },
      "project_id": "growth",
      "revision": 2,
      "run_id": "run_01jaf3q2x8m9v7k5h4g3f2e1d0",
      "started_at": "2026-10-15T09:30:00Z",
      "status": "running",
      "tenant_id": "acme",
      "workflow_id": "wf_01jaf3e1f2g3h4j5k6m7n8p9q0"
    }
  ],
  "properties": {
    "cost": {
      "anyOf": [
        {
          "$ref": "#/$defs/RunCost"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "created_at": {
      "format": "date-time",
      "title": "Created At",
      "type": "string"
    },
    "created_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Created By"
    },
    "decisions": {
      "items": {
        "$ref": "#/$defs/BranchDecision"
      },
      "title": "Decisions",
      "type": "array"
    },
    "error": {
      "anyOf": [
        {
          "$ref": "#/$defs/NodeError"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "finished_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Finished At"
    },
    "inputs": {
      "additionalProperties": {
        "type": "string"
      },
      "title": "Inputs",
      "type": "object"
    },
    "nodes": {
      "items": {
        "$ref": "#/$defs/NodeRun"
      },
      "title": "Nodes",
      "type": "array"
    },
    "outputs": {
      "additionalProperties": {
        "$ref": "#/$defs/NodeOutputRef"
      },
      "title": "Outputs",
      "type": "object"
    },
    "params": {
      "additionalProperties": {
        "$ref": "#/$defs/JsonValue"
      },
      "title": "Params",
      "type": "object"
    },
    "parent_run_id": {
      "anyOf": [
        {
          "examples": [
            "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
          ],
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Parent Run Id"
    },
    "project_id": {
      "pattern": "^[a-z0-9](?:[a-z0-9_-]{0,62}[a-z0-9])?$",
      "title": "Project Id",
      "type": "string"
    },
    "revision": {
      "minimum": 1,
      "title": "Revision",
      "type": "integer"
    },
    "run_id": {
      "description": "The parent run (kind workflow)",
      "examples": [
        "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
      ],
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
      "title": "Run Id",
      "type": "string"
    },
    "started_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Started At"
    },
    "status": {
      "$ref": "#/$defs/WorkflowRunStatus"
    },
    "tenant_id": {
      "pattern": "^[a-z0-9](?:[a-z0-9_-]{0,62}[a-z0-9])?$",
      "title": "Tenant Id",
      "type": "string"
    },
    "trigger": {
      "$ref": "#/$defs/WorkflowTriggerEvent",
      "default": "manual"
    },
    "trigger_id": {
      "anyOf": [
        {
          "examples": [
            "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
          ],
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The schedule or trigger that started it",
      "title": "Trigger Id"
    },
    "workflow_id": {
      "examples": [
        "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
      ],
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
      "title": "Workflow Id",
      "type": "string"
    }
  },
  "required": [
    "run_id",
    "workflow_id",
    "revision",
    "tenant_id",
    "project_id",
    "status",
    "created_at"
  ],
  "title": "WorkflowRun",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
