Skip to main content
<Sequence> groups its children and executes them one at a time, in order, from top to bottom. Each child must complete before the next one starts.

Import

import { Sequence } from "smithers-orchestrator";

Props

PropTypeDefaultDescription
skipIfbooleanfalseWhen true, the entire sequence and all its children are skipped. The component returns null and no child tasks are mounted.
childrenReactNodeundefinedThe tasks and control-flow components to execute sequentially.

Usage

<Workflow name="pipeline">
  <Sequence>
    <Task id="fetch" output="fetch">
      {{ url: "https://api.example.com/data" }}
    </Task>
    <Task id="transform" output="transform" agent={transformer}>
      {`Transform the data: ${ctx.output("fetch", { nodeId: "fetch" }).url}`}
    </Task>
    <Task id="store" output="store">
      {{ stored: true }}
    </Task>
  </Sequence>
</Workflow>
In this example, fetch runs first. Only after it completes does transform start. store runs last.

When to use Sequence explicitly

<Workflow> already sequences its direct children implicitly, so a top-level <Sequence> is optional. You need an explicit <Sequence> when you want to enforce ordering inside other control-flow components:
<Workflow name="build-and-deploy">
  <Parallel maxConcurrency={2}>
    {/* Each branch runs its own steps in order */}
    <Sequence>
      <Task id="build-frontend" output="buildFrontend">
        {{ status: "built" }}
      </Task>
      <Task id="test-frontend" output="testFrontend">
        {{ passed: true }}
      </Task>
    </Sequence>
    <Sequence>
      <Task id="build-backend" output="buildBackend">
        {{ status: "built" }}
      </Task>
      <Task id="test-backend" output="testBackend">
        {{ passed: true }}
      </Task>
    </Sequence>
  </Parallel>
</Workflow>
Here, the two <Sequence> groups run in parallel with each other, but the tasks within each group run sequentially.

Conditional skipping

Use skipIf to conditionally bypass an entire group of tasks:
<Sequence skipIf={ctx.input.skipTests}>
  <Task id="unit-tests" output="unitTests">
    {{ passed: true }}
  </Task>
  <Task id="integration-tests" output="integrationTests">
    {{ passed: true }}
  </Task>
</Sequence>
When skipIf is true, the component returns null. None of the child tasks are mounted into the workflow graph, so they do not appear in the execution plan at all.

Rendering

Internally, <Sequence> renders as a <smithers:sequence> host element (or null when skipped). The runtime traverses the element tree and assigns ordinals to tasks in the order they appear.

Notes

  • Child ordering matches JSX source order. The first child in the JSX runs first.
  • <Sequence> can be nested inside <Parallel>, <Branch>, <Ralph>, or another <Sequence>.
  • An empty <Sequence> (no children) is valid and produces no tasks.