{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scale-ai/json-schema/scale-ai-application-processing-request-schema.json",
  "title": "ApplicationProcessingRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scale-ai-applications-api-openapi.yml#/components/schemas/ApplicationProcessingRequest",
  "properties": {
    "inputs": {
      "additionalProperties": true,
      "type": "object",
      "title": "Inputs",
      "description": "Input data for the application. For agents service variants, you must provide inputs as a mapping from `{input_name: input_value}`. For V0 variants, you must specify the node your input should be passed to, structuring your input as `{node_id: {input_name: input_value}}`."
    },
    "history": {
      "title": "History",
      "description": "History of the application",
      "default": [],
      "items": {
        "$ref": "#/$defs/ApplicationRequestResponsePair"
      },
      "type": "array"
    },
    "overrides": {
      "anyOf": [
        {
          "$ref": "#/$defs/AgenticApplicationOverrides"
        },
        {
          "additionalProperties": {
            "$ref": "#/$defs/KnowledgeBaseNodeOverride"
          },
          "type": "object"
        }
      ],
      "title": "Overrides",
      "description": "Optional overrides for the application"
    },
    "stream": {
      "title": "Stream",
      "description": "Control to have streaming of the endpoint. If the last node before the output is a completion node, you can set this to true to get the output as soon as the completion node has a token",
      "default": false,
      "type": "boolean"
    },
    "operation_metadata": {
      "title": "Operation Metadata",
      "description": "Arbitrary user-defined metadata that can be attached to the process operations and will be registered in the interaction.",
      "additionalProperties": true,
      "type": "object"
    }
  },
  "type": "object",
  "required": [
    "inputs"
  ],
  "$defs": {
    "AgenticApplicationOverrides": {
      "properties": {
        "concurrent": {
          "type": "boolean",
          "title": "Concurrent",
          "default": false
        },
        "use_channels": {
          "type": "boolean",
          "title": "Use Channels",
          "default": false
        },
        "initial_state": {
          "$ref": "#/$defs/MachineState"
        },
        "partial_trace": {
          "title": "Partial Trace",
          "items": {
            "$ref": "#/$defs/LegacySpan"
          },
          "type": "array"
        },
        "return_span": {
          "type": "boolean",
          "title": "Return Span",
          "default": true
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "AgenticApplicationOverrides",
      "description": "Execution override options for agentic applications"
    },
    "ApplicationRequestResponsePair": {
      "properties": {
        "request": {
          "type": "string",
          "title": "Request",
          "description": "Request inputs"
        },
        "response": {
          "type": "string",
          "title": "Response",
          "description": "Response outputs"
        },
        "session_data": {
          "title": "Session Data",
          "description": "Session data corresponding to the request response pair",
          "default": {},
          "additionalProperties": true,
          "type": "object"
        }
      },
      "type": "object",
      "required": [
        "request",
        "response"
      ],
      "title": "ApplicationRequestResponsePair"
    },
    "KnowledgeBaseNodeOverride": {
      "properties": {
        "type": {
          "type": "string",
          "const": "knowledge_base_schema",
          "title": "Type",
          "default": "knowledge_base_schema"
        },
        "artifact_ids_filter": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Artifact Ids Filter"
        },
        "artifact_name_regex": {
          "title": "Artifact Name Regex",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object",
      "title": "KnowledgeBaseNodeOverride"
    },
    "LegacySpan": {
      "properties": {
        "workflow_id": {
          "type": "string",
          "title": "Workflow Id"
        },
        "node_id": {
          "type": "string",
          "title": "Node Id"
        },
        "operation_type": {
          "type": "string",
          "title": "Operation Type"
        },
        "start_timestamp": {
          "type": "string",
          "title": "Start Timestamp"
        },
        "operation_input": {
          "type": "string",
          "title": "Operation Input"
        },
        "operation_output": {
          "type": "string",
          "title": "Operation Output"
        },
        "operation_metadata": {
          "title": "Operation Metadata",
          "additionalProperties": true,
          "type": "object"
        },
        "duration_ms": {
          "type": "integer",
          "title": "Duration Ms"
        }
      },
      "type": "object",
      "required": [
        "workflow_id",
        "node_id",
        "operation_type",
        "start_timestamp",
        "operation_input",
        "operation_output",
        "duration_ms"
      ],
      "title": "LegacySpan"
    },
    "MachineState": {
      "properties": {
        "current_node": {
          "type": "string",
          "title": "Current Node"
        },
        "state": {
          "additionalProperties": true,
          "type": "object",
          "title": "State"
        }
      },
      "type": "object",
      "required": [
        "current_node",
        "state"
      ],
      "title": "MachineState"
    }
  }
}