Skip to main content

4.11.1. Workflows. Lesson 1: Getting Started with Workflows

Workflows check and edit generated results automatically: they can replace words, cut text to a length limit, or flag a result for manual review before it reaches the store. You set the rules once, and they apply to every new result.

In this lesson you will build your first workflow, see how it behaves, and learn a few things to watch out for along the way.

The example we work with​

Our flow generates a short delivery description for a cake:

We are delighted to deliver your chosen cake directly to the address you provide… Each Festive Cake will arrive in beautiful gift packaging… every celebration deserves a delicious CAKE…

The word "cake" appears three times, in three different cases. Keep this in mind, it will matter later.

Step 1. Create a workflow​

Go to Home → Workflows and click Create workflow.

Workflows page with the Create workflow button

The editor opens with the default name New workflow 1. Give the workflow a clear name right away: once you have several, generic names are easy to mix up.

Empty workflow editor with the Create block button

Note: the Active toggle is on by default. A workflow has no effect until it is assigned to a flow, but once assigned, an active workflow starts processing results.

Step 2. Set up a block​

Click Create block. A block appears on the canvas with two parts:

  • IF: the conditions under which the block runs.
  • THEN: the actions it performs.

A new empty block on the canvas

Click the pencil icon to open the block settings.

Empty Edit block window

Conditions​

Each condition has three parts: what to check, an operator, and a value. There are two things you can check:

Condition types: Length and Text

Length is the text length in characters, spaces included. Operators: greater than, greater or equal, less than, less or equal, equals, not equal.

Length operators

Text checks the content. Operators: contains, does not contain, begins with, ends with, is empty, is not empty.

Text operators

With more than one condition, choose the logic:

  • All conditions: every condition must be met (AND).
  • Any condition: one is enough (OR).

Actions​

Three actions are available. The descriptions are shown right in the dropdown.

The three available actions

  • Replace text: replaces a word or phrase. Leave Replace with empty to remove it. HTML tags are not affected.
  • Truncate: cuts the text to a maximum number of characters.
  • Mark suspicious: flags the result for manual review.

A block can hold several actions. They run top to bottom.

Your first block​

Task: if the text contains "Happy holidays!", replace "cake" with "festive cake".

  1. Name: cake -> festive cake
  2. Conditions → Add condition: Text · contains · Happy holidays!
  3. Actions → Add action: Replace text, Find cake, Replace with festive cake, All matches on (replace every match, not only the first).
  4. Click Apply.

Block settings for the first example

The block on the canvas now shows a summary of its conditions and actions. Check that Active is on and click Save.

Saved block with summary, Active toggle and Save button

Step 3. Assign the workflow to a flow​

A saved workflow does nothing until it is attached to a flow.

  1. Open your flow and go to the Automation tab (the 4th tab).
  2. At the bottom, in the Workflows section, pick your workflow from the dropdown.
  3. Click Save to save the flow.

Workflows section of a flow with an assigned workflow

Generate a new result and open it from the Batch List (the table of generated results).

Step 4. Check the result​

The text containing "Happy holidays!" has changed:

Result with "festive cake" and "Festive festive cake"

Notice "Festive festive cake". The model wrote "Festive Cake" with a capital C, and without Match case the replacement ignores letter case, so "Cake" was replaced too.

Fix: turn on Match case. Only lowercase "cake" is then replaced, and "Festive Cake" stays as it is.

Keep in mind: Replace text does not look at context, it only looks for matches. If the model already wrote "delicious cake", replacing cake with delicious cake gives "delicious delicious cake". Think about how your replacement will behave on different texts.

Step 5. How results are processed​

If you change a workflow's settings and reopen a result it already processed, the result stays the same. This is how the system works:

  • Workflows process only new and regenerated results.
  • Each result is processed by a given workflow only once. Editing its blocks does not affect results it has already processed.
  • Changes are permanent. Removing a workflow from a flow does not restore the original text.

To apply new settings, regenerate the result.

Tip: try new workflows on a test flow first. Changes to processed results cannot be rolled back, only regenerated.

Step 6. Multiple workflows​

To fix texts where "Festive festive" appears, you can add a second workflow. This one also flags the result for review:

  • Conditions: Text · contains · Festive festive
  • Actions:
    1. Replace text: Festive festive → Festive, All matches and Match case on
    2. Mark suspicious with a reason for the reviewer

Fix workflow with Replace text and Mark suspicious

You can assign any number of workflows to a flow. They run top to bottom, and each one receives the text as changed by the previous one. Reorder them by dragging the handle or with the arrows.

Four workflows assigned to one flow

Recommended order:

  1. Workflows that change the text.
  2. Workflows that fix side effects of the ones above. A fix must run after the workflow that causes the problem.
  3. Mark suspicious can go anywhere: it does not stop processing.

If several workflows mark a result as suspicious, the reason from the first one in the list is shown.

Step 7. Truncate with manual review​

Task: replace "cake" with "candies", limit the text to 110 characters, and keep the shortened text out of the store until someone checks it.

  • Conditions (All conditions):
    • Text · contains · cake
    • Length · greater than · 100
  • Actions, in this order:
    1. Replace text: cake → candies, All matches and Match case on
    2. Truncate: 110, Keep whole words on
    3. Mark suspicious: reason Truncated to 110 characters

Block with Replace text, Truncate and Mark suspicious

Why the order matters: "candies" is longer than "cake". If you truncate first and replace after, the text can go over the limit again. Replace first, then truncate.

Result:

Truncated result, 109 characters

The text is 109 characters long and no word is cut in half. Words joined by a hyphen, like "door-complete", count as one word. No "…" is added at the end. The sentence, however, is unfinished, which is why Mark suspicious is part of this block.

A suspicious result is not synced to the store until a user edits or regenerates it. In the Batch List, an "!" icon appears next to Sync Now, and the reason shows on hover:

Suspicious reason shown next to Sync Now

Inside the result, a Synchronization with integration is disabled warning shows the reason:

Synchronization disabled warning with the workflow reason

Integration suspicious words come first. The integration has its own list of suspicious words and patterns. If the text contains one, the result gets the system reason "Completion looks suspicious, possible AI recommendations found", and workflow reasons are not shown. The matched word is highlighted in orange.

System suspicious warning with a highlighted word

Quick reference​

SettingHow it works
All / Any conditionEvery condition must be met / one is enough
LengthText length in characters, spaces included
Replace textEmpty Replace with removes the match; HTML tags are not affected
All matchesOff: only the first match is replaced
Match caseOff: replacement ignores letter case
TruncateNo "…" added; Keep whole words keeps words intact
Mark suspiciousBlocks sync to the store; does not stop other actions or workflows
Several suspicious marksThe reason from the first workflow is shown
Integration suspicious wordsTake priority over workflow reasons
ProcessingOnly new and regenerated results, once per workflow; changes are permanent

What's next​

The next lesson shows how to connect several blocks with the Yes, No and Always outputs, so one workflow can handle different texts in different ways.

Continue with 4.11.2. Lesson 2: Combining Blocks in One Workflow.