{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/everyn-ai/json-schema/everyn-ai-run-response-schema.json",
  "title": "RunResponse",
  "x-generated": "2026-11-07",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/everyn-ai-openapi.json#/components/schemas/RunResponse",
  "additionalProperties": false,
  "properties": {
    "agentThreadId": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agentthreadid"
    },
    "billingIngestCompletedAt": {
      "anyOf": [
        {
          "description": "UTC RFC 3339 timestamp string.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Billingingestcompletedat"
    },
    "cancelRequestedAt": {
      "anyOf": [
        {
          "description": "UTC RFC 3339 timestamp string.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cancelrequestedat"
    },
    "completedAt": {
      "anyOf": [
        {
          "description": "UTC RFC 3339 timestamp string.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Completedat"
    },
    "createdAt": {
      "description": "UTC RFC 3339 timestamp string.",
      "title": "Createdat",
      "type": "string"
    },
    "datasetId": {
      "minLength": 1,
      "title": "Datasetid",
      "type": "string"
    },
    "datasetQueryContext": {
      "$ref": "#/$defs/DatasetQueryContextResponse"
    },
    "executionLane": {
      "anyOf": [
        {
          "const": "agent_query",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Executionlane"
    },
    "firstStartedAt": {
      "anyOf": [
        {
          "description": "UTC RFC 3339 timestamp string.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Firststartedat"
    },
    "id": {
      "minLength": 1,
      "title": "Id",
      "type": "string"
    },
    "idempotencyKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Idempotencykey"
    },
    "jobSpecId": {
      "minLength": 1,
      "title": "Jobspecid",
      "type": "string"
    },
    "jobSpecVersionId": {
      "minLength": 1,
      "title": "Jobspecversionid",
      "type": "string"
    },
    "lineageManagedAiUsage": {
      "anyOf": [
        {
          "$ref": "#/$defs/ManagedAiUsageSummaryResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "lineageModelUsage": {
      "anyOf": [
        {
          "$ref": "#/$defs/RowModelSpendResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "managedAiUsage": {
      "anyOf": [
        {
          "$ref": "#/$defs/ManagedAiUsageSummaryResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "mcpCreation": {
      "anyOf": [
        {
          "$ref": "#/$defs/McpCreationResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "mcpRecoveryRequired": {
      "default": false,
      "title": "Mcprecoveryrequired",
      "type": "boolean"
    },
    "mode": {
      "enum": [
        "add_columns",
        "create_rows"
      ],
      "title": "Mode",
      "type": "string"
    },
    "modelUsage": {
      "$ref": "#/$defs/ModelUsageSummary"
    },
    "orgId": {
      "minLength": 1,
      "title": "Orgid",
      "type": "string"
    },
    "resumeAvailable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resumeavailable"
    },
    "resumeBlockedReason": {
      "anyOf": [
        {
          "enum": [
            "mcp_dependency",
            "insufficient_ai_balance",
            "billing_restricted",
            "billing_unavailable"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resumeblockedreason"
    },
    "retryOfRunId": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Retryofrunid"
    },
    "rowCounts": {
      "$ref": "#/$defs/RunRowCountsResponse"
    },
    "scope": {
      "additionalProperties": true,
      "title": "Scope",
      "type": "object"
    },
    "startedAt": {
      "anyOf": [
        {
          "description": "UTC RFC 3339 timestamp string.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Startedat"
    },
    "state": {
      "enum": [
        "draft",
        "queued",
        "running",
        "paused",
        "succeeded",
        "completed_with_flags",
        "failed",
        "canceled"
      ],
      "title": "State",
      "type": "string"
    },
    "updatedAt": {
      "anyOf": [
        {
          "description": "UTC RFC 3339 timestamp string.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updatedat"
    }
  },
  "required": [
    "id",
    "orgId",
    "datasetId",
    "jobSpecId",
    "jobSpecVersionId",
    "retryOfRunId",
    "agentThreadId",
    "mode",
    "scope",
    "datasetQueryContext",
    "executionLane",
    "state",
    "rowCounts",
    "modelUsage",
    "managedAiUsage",
    "lineageModelUsage",
    "lineageManagedAiUsage",
    "idempotencyKey",
    "createdAt",
    "updatedAt",
    "startedAt",
    "firstStartedAt",
    "completedAt",
    "cancelRequestedAt",
    "billingIngestCompletedAt"
  ],
  "type": "object",
  "$defs": {
    "DatasetQueryAliasResponse": {
      "additionalProperties": false,
      "properties": {
        "alias": {
          "title": "Alias",
          "type": "string"
        },
        "columnMap": {
          "title": "Columnmap"
        },
        "datasetId": {
          "minLength": 1,
          "title": "Datasetid",
          "type": "string"
        },
        "rowCount": {
          "minimum": 0.0,
          "title": "Rowcount",
          "type": "integer"
        },
        "schema": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Schema",
          "type": "array"
        },
        "snapshotId": {
          "title": "Snapshotid",
          "type": "string"
        },
        "sourceName": {
          "title": "Sourcename",
          "type": "string"
        }
      },
      "required": [
        "alias",
        "datasetId",
        "rowCount",
        "snapshotId",
        "sourceName"
      ],
      "title": "DatasetQueryAliasResponse",
      "type": "object"
    },
    "DatasetQueryContextResponse": {
      "additionalProperties": false,
      "properties": {
        "aliases": {
          "items": {
            "$ref": "#/$defs/DatasetQueryAliasResponse"
          },
          "title": "Aliases",
          "type": "array"
        }
      },
      "title": "DatasetQueryContextResponse",
      "type": "object"
    },
    "ManagedAiUsageComponentResponse": {
      "additionalProperties": false,
      "properties": {
        "activeHoldAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Activeholdamount",
          "type": "string"
        },
        "activeHolds": {
          "minimum": 0.0,
          "title": "Activeholds",
          "type": "integer"
        },
        "committedAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Committedamount",
          "type": "string"
        },
        "settledActions": {
          "minimum": 0.0,
          "title": "Settledactions",
          "type": "integer"
        },
        "settledAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Settledamount",
          "type": "string"
        }
      },
      "required": [
        "settledAmount",
        "activeHoldAmount",
        "committedAmount",
        "settledActions",
        "activeHolds"
      ],
      "title": "ManagedAiUsageComponentResponse",
      "type": "object"
    },
    "ManagedAiUsageSummaryResponse": {
      "additionalProperties": false,
      "description": "Exact customer-wallet value attributable to a run or row.",
      "properties": {
        "activeHoldAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Activeholdamount",
          "type": "string"
        },
        "committedAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Committedamount",
          "type": "string"
        },
        "currencyCode": {
          "maxLength": 3,
          "minLength": 3,
          "title": "Currencycode",
          "type": "string"
        },
        "model": {
          "$ref": "#/$defs/ManagedAiUsageComponentResponse"
        },
        "paidTools": {
          "$ref": "#/$defs/ManagedAiUsageComponentResponse"
        },
        "settledAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Settledamount",
          "type": "string"
        }
      },
      "required": [
        "currencyCode",
        "settledAmount",
        "activeHoldAmount",
        "committedAmount",
        "model",
        "paidTools"
      ],
      "title": "ManagedAiUsageSummaryResponse",
      "type": "object"
    },
    "McpCreationResponse": {
      "additionalProperties": false,
      "description": "Smallest safe MCP attribution for product reads.\n\nServer-derived only. Omits grant id, actor id, organization id, role,\nscopes, tokens, and raw OAuth identifiers.",
      "properties": {
        "channel": {
          "const": "mcp",
          "title": "Channel",
          "type": "string"
        },
        "clientId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Clientid"
        },
        "principalType": {
          "enum": [
            "workos_jwt",
            "api_key"
          ],
          "title": "Principaltype",
          "type": "string"
        }
      },
      "required": [
        "channel",
        "principalType"
      ],
      "title": "McpCreationResponse",
      "type": "object"
    },
    "ModelUsageSummary": {
      "additionalProperties": false,
      "properties": {
        "inputTokens": {
          "minimum": 0.0,
          "title": "Inputtokens",
          "type": "integer"
        },
        "outputTokens": {
          "minimum": 0.0,
          "title": "Outputtokens",
          "type": "integer"
        },
        "providerAttempts": {
          "$ref": "#/$defs/ProviderAttemptsSummary"
        },
        "providerCost": {
          "$ref": "#/$defs/ProviderCostSummary"
        },
        "totalTokens": {
          "minimum": 0.0,
          "title": "Totaltokens",
          "type": "integer"
        }
      },
      "required": [
        "inputTokens",
        "outputTokens",
        "totalTokens",
        "providerAttempts",
        "providerCost"
      ],
      "title": "ModelUsageSummary",
      "type": "object"
    },
    "ProviderAttemptsSummary": {
      "additionalProperties": false,
      "properties": {
        "failed": {
          "minimum": 0.0,
          "title": "Failed",
          "type": "integer"
        },
        "succeeded": {
          "minimum": 0.0,
          "title": "Succeeded",
          "type": "integer"
        },
        "total": {
          "minimum": 0.0,
          "title": "Total",
          "type": "integer"
        }
      },
      "required": [
        "total",
        "succeeded",
        "failed"
      ],
      "title": "ProviderAttemptsSummary",
      "type": "object"
    },
    "ProviderCostSummary": {
      "additionalProperties": false,
      "properties": {
        "currencyCode": {
          "default": "USD",
          "maxLength": 3,
          "minLength": 3,
          "title": "Currencycode",
          "type": "string"
        },
        "pricedAmount": {
          "description": "Decimal amount serialized as a string to preserve precision.",
          "title": "Pricedamount",
          "type": "string"
        },
        "status": {
          "enum": [
            "priced",
            "partially_priced",
            "pricing_unavailable",
            "usage_unavailable",
            "not_billable"
          ],
          "title": "Status",
          "type": "string"
        },
        "totalAmount": {
          "anyOf": [
            {
              "description": "Decimal amount serialized as a string to preserve precision.",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Totalamount"
        }
      },
      "required": [
        "status",
        "totalAmount",
        "pricedAmount"
      ],
      "title": "ProviderCostSummary",
      "type": "object"
    },
    "RowModelSpendResponse": {
      "additionalProperties": false,
      "description": "Per-row model spend (H4S-283).\n\nAbsent entirely for a row with nothing recorded yet. `status` carries the\npricing state, so a run that has spent money the provider has not priced\ncannot be mistaken for a free one; `totalAmount` is null in exactly that\ncase.",
      "properties": {
        "currencyCode": {
          "title": "Currencycode",
          "type": "string"
        },
        "pricedAmount": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pricedamount"
        },
        "status": {
          "title": "Status",
          "type": "string"
        },
        "totalAmount": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Totalamount"
        }
      },
      "required": [
        "currencyCode",
        "status"
      ],
      "title": "RowModelSpendResponse",
      "type": "object"
    },
    "RunRowCountsResponse": {
      "additionalProperties": false,
      "properties": {
        "failed": {
          "minimum": 0.0,
          "title": "Failed",
          "type": "integer"
        },
        "flagged": {
          "minimum": 0.0,
          "title": "Flagged",
          "type": "integer"
        },
        "pending": {
          "minimum": 0.0,
          "title": "Pending",
          "type": "integer"
        },
        "processed": {
          "minimum": 0.0,
          "title": "Processed",
          "type": "integer"
        },
        "running": {
          "minimum": 0.0,
          "title": "Running",
          "type": "integer"
        },
        "skipped": {
          "minimum": 0.0,
          "title": "Skipped",
          "type": "integer"
        },
        "succeeded": {
          "minimum": 0.0,
          "title": "Succeeded",
          "type": "integer"
        },
        "total": {
          "minimum": 0.0,
          "title": "Total",
          "type": "integer"
        }
      },
      "required": [
        "total",
        "processed",
        "pending",
        "running",
        "succeeded",
        "flagged",
        "failed",
        "skipped"
      ],
      "title": "RunRowCountsResponse",
      "type": "object"
    }
  }
}