Skip to main content

Template Variables

Template variables let you create dynamic prompts that change based on variable values. Instead of writing a separate prompt for every variation, you define placeholders using the {{variable_name}} syntax and swap values at generation time -- ideal for batch generation across different products, names, or descriptions.

What Are Variables?

A template variable is a named placeholder inside a prompt. When you run a generation, XainFlow replaces each placeholder with the value you provide. This turns a single prompt template into a reusable blueprint for many outputs.

Example prompt with variables:

A professional photo of {{product_name}} on a {{background_type}} background,
studio lighting, {{style}} style

When you generate, you provide values like product_name = "running shoes", background_type = "white marble", and style = "minimalist", and the AI receives the fully substituted prompt.

Variable Types

TypeDescriptionExample Value
TextFree-form text input"running shoes", "sunset beach"
NumberNumeric values3, 1080, 0.5
ImageReference to an image assetAn uploaded product photo

Creating Variables

  1. Open a workflow in Flow Studio.
  2. Select a node that accepts prompts (such as the Prompt Generator Node).
  3. In the prompt field, type {{ to start a variable placeholder, then enter the variable name and close with }}.
  4. The variable appears in the Variables Panel on the side, where you can set its type and default value.

Using Variables for Batch Generation

Variables are most powerful when combined with batch generation:

  1. Define your prompt template with one or more {{variables}}.
  2. Open the Variables Panel.
  3. Provide multiple value sets -- one for each variation you want to generate.
  4. Run the workflow. XainFlow generates one output per value set.
tip

Use descriptive variable names like {{product_name}} or {{scene_description}} rather than generic names like {{var1}}. This makes your templates easier to understand and maintain, especially when sharing workflows with team members.

Variable Management

You can manage all variables for a workflow from the Variables Panel:

  • Edit -- change a variable's name, type, or default value.
  • Delete -- remove a variable you no longer need. Any prompt references to that variable will show as unresolved.
  • Reorder -- drag variables to change their display order in the panel.