{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scale-ai/json-schema/scale-ai-test-application-processing-request-schema.json",
  "title": "TestApplicationProcessingRequest",
  "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/TestApplicationProcessingRequest",
  "properties": {
    "inputs": {
      "additionalProperties": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "object",
      "title": "Inputs",
      "description": "Input data for the application. You must provide inputs for each input node"
    },
    "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"
    },
    "nodes": {
      "items": {
        "$ref": "#/$defs/ApplicationNode"
      },
      "type": "array",
      "title": "Nodes",
      "description": "List of nodes in the application graph"
    },
    "edges": {
      "items": {
        "$ref": "#/$defs/ApplicationEdge"
      },
      "type": "array",
      "title": "Edges",
      "description": "List of edges in the application graph"
    },
    "version": {
      "type": "string",
      "const": "V0",
      "title": "Version",
      "description": "Version of the application schema"
    }
  },
  "type": "object",
  "required": [
    "inputs",
    "nodes",
    "edges",
    "version"
  ],
  "$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"
    },
    "ApplicationEdge": {
      "properties": {
        "from_node": {
          "type": "string",
          "title": "From Node"
        },
        "to_node": {
          "type": "string",
          "title": "To Node"
        },
        "from_field": {
          "type": "string",
          "title": "From Field"
        },
        "to_field": {
          "type": "string",
          "title": "To Field"
        }
      },
      "type": "object",
      "required": [
        "from_node",
        "to_node",
        "from_field",
        "to_field"
      ],
      "title": "ApplicationEdge"
    },
    "ApplicationNode": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "application_node_schema_id": {
          "$ref": "#/$defs/NodeSchemaId"
        },
        "configuration": {
          "additionalProperties": {
            "$ref": "#/$defs/ConfigurationFieldValue"
          },
          "type": "object",
          "title": "Configuration"
        }
      },
      "type": "object",
      "required": [
        "id",
        "application_node_schema_id"
      ],
      "title": "ApplicationNode"
    },
    "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"
    },
    "ConfigurationFieldValue": {
      "properties": {
        "value": {
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "value"
      ],
      "title": "ConfigurationFieldValue"
    },
    "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"
    },
    "NodeSchemaId": {
      "type": "string",
      "enum": [
        "text_input_schema",
        "text_output_schema",
        "knowledge_base_input_schema",
        "knowledge_base_schema",
        "multi_knowledge_base_input_schema",
        "multi_knowledge_base_schema",
        "reranker_schema",
        "prompt_engineering_schema",
        "completion_model_input_schema",
        "completion_model_schema",
        "external_endpoint_schema",
        "document_input_schema",
        "map_reduce_schema",
        "document_search_schema",
        "document_prompt_schema"
      ],
      "title": "NodeSchemaId"
    }
  }
}