def app_request(spoke_id, function, functionality_request):
        """
        Create an application request message.

        Args:
            spoke_id (str): The ID of the spoke sending the request.
            function (str): The functionality being requested.
            functionality_request (str): The request body formatted in JSON.

        Returns:
            bytes: The JSON-encoded application request message.

        """
        message = {}
        message["message_type"] = "app_request"
        message["spoke_id"] = spoke_id
        message["functionality_request"] = function
        message["request_body"] = functionality_request  # format the request with json
        return json.dumps(message).encode("utf-8")

        Create an application request message.

        Args:
            spoke_id (str): The ID of the spoke sending the request.
            function (str): The functionality being requested.
            functionality_request (str): The request body formatted in JSON.

        Returns:
            bytes: The JSON-encoded application request message.

        
llama-index-packs/llama-index-packs-secgpt/llama_index/packs/secgpt/message.py