For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/steps/parallel.md.

parallel

Executes multiple steps concurrently, each on a separate goroutine, and waits for all branches to complete.

Declaration

parallel {
  sql "fetch_account" {
    # branch 1
  }

  sql "fetch_invoices" {
    # branch 2
  }

  redis "fetch_metrics" {
    # branch 3
  }
}

Semantics

  1. Each branch executes independently and cannot see other branch results until the block completes.
  2. Execution pauses at the closing brace until every branch finishes.
  3. An error in any branch cancels the remaining branches and fails the pipeline.
  4. Branch outputs are available under ctx.steps.<name> after the block completes.

See Parallel aggregation for a complete example.