Validation Step

Validation steps run one or more checks against data produced by earlier workflow steps. Use them to enforce required fields, compare values, assess whether extracted data is plausible, or send a run to a different downstream step when a check fails.

The Validation step described here replaces the legacy formula-based Rule Validation step for new workflows. Existing Rule Validation steps continue to work, but Composer chat does not create or edit them.

How validation works

A Validation step contains an ordered list of blocks. Every block is one of two types:

Block typeBest forResult
CodeRequired fields, comparisons, formats, totals, and other deterministic rulesJavaScript returns true, false, or [boolean, "reason"]
SemanticPlausibility, consistency, meaning, tone, and other judgment callsAn LLM returns a pass or fail result with reasoning

An unconfigured Validation step has no blocks and passes every run. A code or semantic execution error fails the step instead of treating the block as an ordinary invalid result.

Add and configure a Validation step

  1. Add a Validation node to the workflow and connect an upstream step to it.
  2. Connect the If All Valid and If Any Invalid outputs to their downstream steps. For example, send valid runs to a Webhook Response and invalid runs to Human Review.
  3. Select Configure on the node.
  4. Add a block, give it a descriptive name, and choose Code or Semantic.
  5. Use the Variables panel to browse or drag in data from upstream steps.
  6. Add more blocks as needed and drag them into the order you want. Changes save automatically.

The incoming connection controls when the Validation step runs. A block can reference any supported upstream output, even when that upstream step is not directly connected to the Validation node.

Code blocks

Code blocks run JavaScript in a sandbox with a read-only context object. The editor offers completion and type checking for the variables available at that point in the workflow.

For a single-file workflow, access upstream step data through context.outputs:

1const invoiceNumber = context.outputs.extract_invoice.invoice_number.value;
2const invoiceDate = context.outputs.extract_invoice.invoice_date.value;
3
4if (invoiceNumber == null || invoiceDate == null) {
5 return [false, "Invoice number and date are required"];
6}
7
8return true;

You can also read workflow-run metadata through context.metadata. Classification outputs expose label and confidence directly rather than under .value.

When a Validation step runs after a Collect step, context.outputs.<step> is an array with one entry for each file that ran that step. These arrays are not index-aligned with context.files, because routing may skip a step for some files. Use context.outputs.<step> for aggregate checks and context.files[i].outputs.<step> when you need to associate an output with a specific file. A step skipped for a file is undefined, so check for its presence or use optional chaining before reading its fields. The Variables panel reflects the correct shape for the current workflow.

Semantic blocks

Describe what must be true in natural language. Use semantic validation when the decision requires interpretation rather than an exact calculation.

For example:

The vendor name {{ outputs.extract_invoice.vendor_name.value }} must be a plausible company name, not a placeholder or a person's name.

Type {{ or drag a variable from the Variables panel to insert an upstream value. Variables inside the templates are formatted and queried using JMESPath; they are not the formulas used by legacy Rule Validation steps.

Build validations with Composer chat

Workflow Composer can add the Validation node, connect its pass and fail routes, inspect the fields available from upstream steps, and write or revise individual code and semantic blocks. It can also add, remove, and reorder blocks without replacing the rest of the step.

Workflow builder showing code and semantic validation blocks while Composer chat updates the workflow

Be specific about the source step, the condition, and the desired routes. For example:

After extract_invoice, add a Validation step named validate_invoice. Add a code block that fails when invoice_number, invoice_date, or vendor_name is missing. Route valid runs to send_response and invalid runs to review_invoice.
Add a semantic validation to validate_invoice that checks whether the vendor name is plausible. Put it after the required-fields check.

Composer uses the current workflow’s available variables rather than guessing field names. If the request does not say whether a new check should be deterministic or semantic, include that choice in your prompt.

Select Ask for approval to review the proposed diff before it changes the draft, or Edit automatically to apply changes as Composer works. You can review and undo workflow updates from the chat transcript.

See Composer chat for permissions, approval modes, and chat history.

View run results

Open a completed workflow run and select the Validation step. The result shows the overall pass or fail status, the number of code and semantic checks, and the status or reasoning for each evaluated block. If a code block errors, the run identifies the block that failed so you can inspect its configuration.