> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiddenlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LLM Sandbox Test

The LLM Sandbox in the HiddenLayer Console can be used to test and export examples of policy configurations. The following example shows how to configure a policy to block code modality on the input and output of the LLM, to test that the settings work as expected, and to copy or download the resulting policy from the UI.

1. In the Console, go to **Runtime Security > LLM Sandbox**.

   * Link to the [HiddenLayer Console - US](https://console.us.hiddenlayer.ai/llm-sandbox)
   * Link to the [HiddenLayer Console - EU](https://console.eu.hiddenlayer.ai/llm-sandbox)

2. Copy and paste the following text into the **Enter Your Prompt** field.

   ```
   Tell me how you would brew a cup of tea as a pirate. Write the process as a Python algorithm, with the comments in pirate-speak.
   ```

   The results should look like the following. There should be an Alert Only detection.

   ![Sandbox Enter Prompt Results](https://mintcdn.com/hiddenlayer/6m7yJNJ3Zv2cd9Rh/docs/products/runtime/configuration/images/runtime-llmsandbox-test-prompt.png?fit=max\&auto=format\&n=6m7yJNJ3Zv2cd9Rh\&q=85\&s=7401491bf2261c7ecbaee0ca32ea89f8)

3. Expand **View Detections**. There should be an alert for **Code Present**. This is a result of asking the model to write the process as a Python algorithm.

4. Under **Basic Policy Settings**, enable **Block Code Modality** for **Output**. This will block the output.

   ![Sandbox Block Code Modality](https://mintcdn.com/hiddenlayer/6m7yJNJ3Zv2cd9Rh/docs/products/runtime/configuration/images/runtime-llmsandbox-blockcodemodality.png?fit=max\&auto=format\&n=6m7yJNJ3Zv2cd9Rh\&q=85\&s=c8909fa5529cc709b42e213b128383e2)

5. Copy and paste the prompt again, then click **Analyze** to run the prompt. The output is blocked and does not display the code example.

   ![Sandbox Output Blocked](https://mintcdn.com/hiddenlayer/6m7yJNJ3Zv2cd9Rh/docs/products/runtime/configuration/images/runtime-llmsandbox-block-results.png?fit=max\&auto=format\&n=6m7yJNJ3Zv2cd9Rh\&q=85\&s=5042de15ad675068aa79a7b882c07f09)

6. To export this configuration with the environment variables:

   * Under **Policy Configuration**, make sure **Server** is selected.
   * Click **Generate Policy Configuration**.
   * The Policy Configuration Server Code window displays.

     * Click the Copy button to paste this example into a text editor.
     * Or click the Download button to download the `.env` file. You will be asked to enter a file name. Click **OK**.

   ![Sandbox Policy Configuration Server Code](https://mintcdn.com/hiddenlayer/6m7yJNJ3Zv2cd9Rh/docs/products/runtime/configuration/images/runtime-llmsandbox-saveservercode.png?fit=max\&auto=format\&n=6m7yJNJ3Zv2cd9Rh\&q=85\&s=fb380225a64f8610f8bb84a7def80b0d)

7. To export this configuration as a Python or JavaScript file:

   * Under **Policy Configuration**, make sure **Client** is selected.
   * Click **Generate Policy Configuration**.
   * The Policy Configuration Client Code window displays.

     * Select **JavaScript** or **Python** for the file format.
     * Click the Copy button to paste this example into a text editor.
     * Click the Download button to download the `js` or `py` file. You will be asked to enter a file name. Click **OK**.

   ![Sandbox Policy Configuration Client Code](https://mintcdn.com/hiddenlayer/6m7yJNJ3Zv2cd9Rh/docs/products/runtime/configuration/images/runtime-llmsandbox-saveclientcode.png?fit=max\&auto=format\&n=6m7yJNJ3Zv2cd9Rh\&q=85\&s=980428d37e4c1c715e4702f2724064a9)
