Skip to content

Prompts and guardrails

AI Prompts in the Chat node

The Chat node's System Prompt field has a picker for Drupal AI's prompt library (/admin/config/ai/prompts). You can:

  • type a prompt directly into the field, or
  • pick an existing prompt of type FlowDrop Workflow Prompt, or create one from the picker.

A picked prompt is stored as a reference, ai_prompt:<prompt id>, so editing the prompt in the library changes every workflow that uses it. When the node runs, the reference resolves to the prompt text. If the referenced prompt was deleted, the node fails.

Variables

Prompt text can contain {message}, which the Chat node replaces with its message input:

You are an editor for a food magazine. Rewrite the following in plain
English, keeping all quantities: {message}

The FlowDrop Workflow Prompt type also declares a workflowName variable. The Chat node does not fill it in, so {workflowName} stays in the text as written.

AI Agents

The same ai_prompt:<prompt id> reference works in the system prompt of an AI Agent from the AI Agents module, with one difference: when the agent is saved, the module replaces the reference with the prompt text. Later edits to the prompt in the library do not reach that agent until you set the reference again. A reference that could not be resolved at save time stays as written and is resolved when the agent builds its system prompt.

AI Guardrails node

Runs a Drupal AI guardrail set against text in a workflow. Create guardrails and sets at /admin/config/ai/guardrails.

Input Type Default Notes
text string The text to check.
guardrail_set string The set to apply. The field offers a picker.
mode input or output input Which guardrails of the set to run: the ones meant before generation (input) or after it (output).
Output Type Notes
passed boolean True when the combined stop score stays below the set's stop threshold.
text string The text, rewritten if a guardrail changed it.
stop_score number Combined score of the guardrails that triggered.
violation_message string Messages from the guardrails that stopped the text.
results array One entry per guardrail with its type, message and score.

A common shape is to check user input before the Chat node and branch on passed:

flowchart LR
    In[Chat input] --> G[AI Guardrails, mode input]
    G -- passed --> C[Chat]
    G -- not passed --> R[Reply with violation_message]
    C --> O[AI Guardrails, mode output]
    O --> Out[Chat output]

The branch itself is a FlowDrop gateway node; this module only provides the passed value to branch on.