Skip to main content

Writing Workflows

A Replay workflow is a YAML file that describes a sequence of steps to execute. Each step performs an action, optionally extracts values into the shared state bag, and asserts outcomes.

Anatomy of a Workflow

The State Bag

Every workflow has a shared state bag — a key-value store that lives across all steps. Values extracted in one step are available in all later steps via {{ variable_name }} syntax.

Step Types

Extract

The extract block maps JSONPath expressions to variable names:
Extracted values are available in all subsequent steps.

Assert

The assert block validates outcomes. Each rule has a path, operator, and expected value:
You can also use the object form:

Templates

Any string field in a step can reference state variables with {{ var }} syntax:
You can also use built-in functions:

Ignoring Errors

Use ignore_error: true to continue execution even when a step fails:

Cleanup

The cleanup field deletes variables from the state bag after a step completes:
This is useful for sensitive data that should not leak to later steps.

Variable Scope

Variables exist in a three-level scope hierarchy:
  1. Global — Environment variables loaded at startup
  2. Workflow — Set via config.vars or extract at the workflow level
  3. Step — Set via extract within a step, cleaned up when the step exits
Inner scopes inherit from outer scopes. A step can read global and workflow variables.

What’s Next?