Skip to content

Test a FlowDrop workflow

A workflow is a pipeline: plain steps, such as a database query or a text template, around one or more model calls. In this tutorial you build a small FlowDrop workflow that turns a news article into a two-sentence teaser and suggests tags, and then you test the teaser with AI Eval.

It takes about an hour. One run of four questions makes about 16 model calls, so it costs a few cents on a typical provider. You need the test skills from Your first test and Improve your test.

You will learn to

  • build a FlowDrop workflow with an input and outputs that AI Eval can use;
  • make the workflow run in a way AI Eval can wait for;
  • set up a test in workflow mode and pick the question port and the output path;
  • read the result, including every step the workflow ran;
  • tell what a workflow test can and cannot show.

Terms with a dotted underline are defined in the Glossary. Point at one to see a short definition; click or tap it to read the full entry.

How a question runs through a workflow

flowchart LR
    Q["Question<br/>an article"] --> P["Question port<br/>article"]
    P --> W["FlowDrop workflow<br/>query, template,<br/>two model calls"]
    W --> O["Output path<br/>summary"]
    O --> J["Judges and checks<br/>score the teaser"]
    J --> S["Score and verdict"]
    W -.-> R["Workflow run<br/>steps and model calls"]

AI Eval does not look inside the workflow to answer. It puts each question on one input, waits for the run, takes one output as the answer and scores it. It also keeps a record of the steps, so you can see where an answer came from.

Before you start

You need:

  • AI Eval's ai_eval_flowdrop module, FlowDrop 2.7.2 or later, and the FlowDrop modules flowdrop_node_processor (input, output and basic nodes) and flowdrop_ai_provider (model nodes that use your AI providers). See the module's README for the install commands.
  • A chat provider and model in the AI module settings.
  • These permissions: Administer AI Eval and Operate AI Eval, and on FlowDrop Create, Edit, View and Execute flowdrop_workflow, View own flowdrop_pipeline and View flowdrop_node_type.
  • An administrator who can run one Drush command for you (part 2).
  • Three to five short news articles you may use. The demo site uses four articles from its own news section.

The screenshots come from the Northmoor demo site, taken as a tester account that has the permissions above and nothing more.

The workflow really runs

Every question runs the workflow for real. This one only reads taxonomy terms and calls a model, so it changes nothing. A workflow that saves content or sends mail does that once per question: test it on a copy of the site.

Part 1: build the workflow

1. Create the workflow

Open /admin/flowdrop/workflows/add. Give the workflow a Label, for example Tester: News summary and tags, and click Save. Note the machine name the form shows next to the label, then open the editor at /admin/flowdrop/workflows/MACHINE_NAME/editor.

Without the Workflows list

FlowDrop's Workflows list (/admin/flowdrop/workflows) needs the Administer flowdrop_workflow permission. With the permissions above you can create and edit a workflow, but you open it by its address. Bookmark the editor.

2. Add and connect the nodes

Drag these nodes from the Nodes list on the left onto the canvas. Search by name to find them quickly. When you search for Text Input, pick the plain Text Input: the search lists Text Input (Interrupt) first, which pauses the workflow for a person.

Node Found under What it does here
Text Input Inputs receives the article
Simple Chat AI writes the teaser
Text Output Outputs returns the teaser
Entity Query Data reads the allowed tags
Prompt Template Prompts builds the tagging prompt
Simple Chat AI chooses tags
Text Output Outputs returns the tags

Connect them by dragging from an output dot on the right of a node to an input dot on the left of the next one:

  • Text Input text to the first Simple Chat Message, and to the Prompt Template Article input (you add that input in step 4).
  • First Simple Chat response to the first Text Output Text Input.
  • Entity Query results to the Prompt Template Terms input.
  • Prompt Template prompt to the second Simple Chat Message.
  • Second Simple Chat response to the second Text Output Text Input.

The finished workflow: Text Input feeds a Simple Chat and a Prompt Template; Entity Query feeds the template; each Simple Chat feeds a Text Output

3. Set the teaser and the term query

Double-click a node to open its settings.

  1. First Simple Chat: choose your model and set the System Prompt to You write short news teasers. Summarize the article in two short sentences. Use only facts stated in the article. Do not add names, places or organizations that the article does not mention.
  2. Entity Query: Entity Type Taxonomy term, Bundle/Content Type the machine name of your tag vocabulary (the demo site uses content_classification), Limit 100, Published Only on, Sort Field name.

The Entity Query settings: Taxonomy term, the content_classification vocabulary, a limit of 100 and published terms only

4. Write the tagging prompt

Open the Prompt Template settings. Under Input Ports, add two inputs: article and terms. Then set the Template:

Choose up to three tags for this news article from the allowed terms. Answer with the chosen term names only, separated by commas, written exactly as in the list. If none fits, answer: none.

Allowed terms:
{% for term in terms %}{{ term.label }}
{% endfor %}
Article:
{{ article }}

Set the second Simple Chat to the same model, with a system prompt such as You tag news articles. Follow the instructions in the message exactly and reply with the tag names only.

The Prompt Template settings with the loop over the terms

Use the names of your own inputs

The Available variables box under the template lists the names of the ports wired into the node (text, results). In the template, use the names of the template's own inputs: article and terms.

Under the hood: why the template loops over the terms

Entity Query returns a list. In a workflow that AI Eval launches, there is no page being built, and Drupal's Twig cannot print a whole list on its own there: the node fails with "Render context is empty". A loop prints one plain value per term, which always works.

5. Declare the workflow's input and outputs

Click Workflow at the top right and open the Interface tab.

  1. Add input: name it article and bind it to Text Input > Input Data.
  2. Add output: name it summary and bind it to the first Text Output > Text.
  3. Add output: name it tags and bind it to the second Text Output > Text.

Click Save.

The Interface tab: input article bound to Text Input, outputs summary and tags bound to the two Text Output nodes

Under the hood: what AI Eval sees of a workflow

AI Eval sees only what the Interface tab declares. Each input becomes a possible question port, and each output a possible output path. A workflow with no declared input cannot take a question, so the test form offers no port for it.

Part 2: make the workflow run while AI Eval waits

AI Eval sends one question, waits for the answer, scores it, and then sends the next. FlowDrop starts a workflow built in the editor in the background, so there would be no answer to wait for. The orchestrator has to run it in the same request instead, and FlowDrop 2.7 has no screen for that.

6. Ask an administrator to set the orchestrator

Give your administrator the machine name of the workflow (it is in the editor's address) and ask them to run:

drush config:set flowdrop_workflow.flowdrop_workflow.WORKFLOW_ID \
  metadata.orchestrator_settings.type flowdrop_runtime:synchronous -y

Do this last, and again after you edit node settings

FlowDrop's editor removes this setting when you change a node's settings and save. Moving nodes keeps it. After such an edit the test stops working until the command runs again, so set it when the workflow is finished.

Under the hood: which orchestrator to choose

flowdrop_runtime:synchronous runs the whole workflow in the same request, which is what AI Eval needs. A workflow whose model calls a tool needs flowdrop_stategraph:stategraph instead: with FlowDrop 2.7.2 only that orchestrator gives a launched workflow its tools. With the synchronous ones, the model gets no tools and the run still completes.

Part 3: create the test

7. Make a dataset of articles

Create a dataset with three to five questions, as in Improve your test. Each question's Input is the full text of one article. Give every question the same Criteria: A short, faithful summary of the article: keeps its main point and key facts, adds nothing that is not in the text.

The demo site already has this dataset, named demo_summaries.

8. Fill in the workflow part of the test form

Open Configuration > AI > AI Eval and click Add test.

  1. Label: Tester: News teaser.
  2. Mode: Workflow. The Workflow settings section opens.
  3. Engine: FlowDrop.
  4. Workflow: your workflow.
  5. Question port: the form picks Input Data (article), the only input.
  6. Fixed inputs (YAML): leave it empty. This workflow has no other input.
  7. Output path: summary. Leave it empty and the test would score both outputs together as one JSON answer, because neither output is marked as the reply.

The Workflow settings: FlowDrop engine, the News summary and tags workflow, Input Data (article) as the question port, and summary as the output path

Your workflow is not in the list?

Open Not listed under the Workflow field. It names each workflow the engine cannot run, with the reason. A workflow built in the editor and not yet changed by part 2 is listed there with the Drush command.

The Chat Provider section stays empty: the workflow's own nodes choose their model.

9. Choose the dataset, graders and gate

  1. Dataset: your articles (on the demo site demo_summaries).
  2. Graders: Completeness Grader, Groundedness Grader and Format Grader. Completeness asks whether the teaser keeps the main point, Groundedness whether it adds anything the article does not say, and Format checks the shape of the reply.
  3. Gate metric: Average score, Gate threshold 4.

Click Save.

Part 4: run the test and read the result

10. Run it

On the dashboard, open your test's Run page and click Run. Keep the page open: the run moves on only while a page shows it. Four questions take about a minute and a half.

11. Read the summary

Click View results.

A result: 3 of 4 questions met expectations, the gate failed at an average of 3.83, with warnings about unvalidated judges and a wide pass-rate range

On the demo site the run scored an average of 3.83, under the gate of 4, so the gate failed. Model under test names the engine and the workflow, not a model, because the workflow chose its own models. The two warnings are the same as in any test: the judges are not validated yet, and four questions are too few for a firm pass rate.

12. Find out why a question failed

The failing question is at the top under Needs attention. Expand it and read the grader reasons before you trust the number.

The failing question: the teaser, and the grader reasons; Groundedness gave 0 because the teaser says the crew redeployed the moorings, which the article does not say

Here Groundedness gave 0 because the teaser says "the crew" recovered and redeployed the moorings, which the article does not say. That is a real finding about the prompt, or a strict judge: decide which by reading the article, then annotate the answer.

13. Look inside the run

Expand Workflow run in the same question.

The Workflow run panel: engine flowdrop, status completed, 5.0 seconds, two model calls with their tokens, then each step with its node title, id, status and time

The panel shows the engine, the status, the time and the model calls the workflow made, then each workflow step in the order it ran. Open Input preview and Output preview on a step to see what it received and returned. For a wrong answer, this tells you whether the query found the wrong terms, the template built the wrong prompt, or the model made the mistake.

Under the hood: what AI Eval stores for each question

With each answer AI Eval stores a record of the workflow run: the engine, the run id, the status, up to 200 model calls and up to 200 steps, with texts shortened to 500 characters. Each step has a kind: model nodes are ai, the query and template are deterministic. If a run fails halfway, the steps it ran stay in the record. See Tests.

Common mistakes

  • The workflow is not in the list. Its orchestrator is not set, or a later edit removed it. See Not listed and part 2.
  • No question port to choose. The Interface tab declares no input.
  • The answer is a JSON object. The output path is empty and the workflow has two outputs. Set it to summary.
  • Runs are refused after you changed a prompt. Editing node settings removed the orchestrator. Ask for the Drush command again.
  • "Render context is empty". A template prints a whole list. Loop over it as in step 4.
Check yourself: the test passed, but every tag the workflow chose is wrong. Why did the test not notice?

The output path is summary, so the judges only read the teaser. The tags are produced but never scored. To test them, make a second test of the same workflow with the output path tags, and score it with a rubric check or a judge that knows the allowed terms.

Check yourself: you changed the teaser's system prompt and saved. The next run is refused. What happened?

Saving after you change a node's settings removes the orchestrator setting, so FlowDrop would run the workflow in the background. AI Eval refuses it before it starts. Ask for the Drush command again.

What a workflow test can and cannot show

  • It shows how the whole pipeline answers real inputs, including the query and the template, not only the model.
  • It scores one output per test. Test the other outputs with their own tests.
  • It runs the workflow for real, once per question, with every write it makes.
  • It cannot see why a model chose its words; the step previews show what each step received and returned.

Next steps