An assistant may need the same support label or reference value in several workspaces. AnythingLLM system prompt variables store that text under a reusable name, allowing a workspace prompt to insert its value through a placeholder.

Custom variables contain static text, unlike built-in variables that supply the current date or workspace name. A reference such as {support_code} uses the variable's exact key inside single braces; an unknown key remains unexpanded without producing a chat error.

Variable values become part of the system prompt sent to the selected model, which can repeat them in its replies. Passwords, API keys and other secrets do not belong in these values; a harmless reference code makes the substitution easy to check.

Steps to create a system prompt variable in AnythingLLM:

  1. Open instance settings with the wrench icon at the bottom of the sidebar.

    This requires access to instance settings and an existing workspace with a working chat provider. Orbit Support is the pictured workspace; your workspace can have any name.

  2. Expand Tools in the settings sidebar.
  3. Open System Prompt Variables under Tools.

    The settings sidebar scrolls independently when its lower entries are out of view.

  4. Click Add Variable above the variables table.
  5. Enter support_code in Key.

    The key must be unused and contain only letters, numbers or underscores. The braces belong in the prompt reference, not in this field.

  6. Enter ORBIT-8462 in Value.

    This is a fictional code for testing. Description is optional.

  7. Click Create variable to save the entry.
  8. Reload the System Prompt Variables page.

    The support_code row should retain ORBIT-8462 with type Static. A missing row or reverted value means the entry was not saved.

  9. Return to workspaces with the back arrow at the bottom of the settings sidebar.
  10. Click the gear beside your workspace's name.
  11. Open the Chat Settings tab.
  12. Select Chat under Chat mode.

    The selection saves automatically. New workspaces start in Agent mode, which can invoke tools with a compatible model; Chat permits an ordinary reply without requiring documents.

  13. Click the current instruction text under System Prompt.

    Replacing this text removes the workspace's previous instructions and affects subsequent replies across its threads. Any instructions you still need belong alongside the variable reference in your own prompt.

  14. Replace the text with the following system prompt.
    You are the Orbit Support assistant. The current support code is {support_code}. When asked for the support code, reply with that code only.

    The literal code belongs only in the variable's Value field. The system prompt refers to {support_code} so the response can demonstrate substitution.

  15. Click the System Prompt heading outside the text box to save the prompt.
  16. Reload the Chat Settings page.

    The saved prompt should retain {support_code} highlighted in blue. A missing highlight can indicate an unknown or misspelled key.

  17. Click New Thread beneath the workspace in the sidebar.

    A fresh thread prevents an earlier conversation from supplying the code.

  18. Enter What is the current support code? in Send a message.
  19. Send the question with the upward-arrow button.
  20. Confirm that the reply contains ORBIT-8462 from the saved variable.

    The question does not contain the code. A reply containing {support_code} or a different value does not demonstrate that the variable was injected; model instruction-following also affects the response.

Share this guide