Skip to Content
We are live but in Staging 🎉
DSL ReferenceSteps: Control Flow And Concurrency

Steps: Control Flow And Concurrency

Last validated: 2026-05-14

This page covers branching, loops, and parallel patterns.

each

Iterates over a collection.

each source in sources do "Fetch source data" with llm prompt = "Analyze {project} from {source} perspective" -> source_analysis -> all_sources

With index:

each item, idx in items do "Log" with echo message = "item {idx}"

With parallel batching:

each name in collection_names parallel 5 do "Search collection" with vector_store_search collection_name = name top_k = 10 -> fanout_results

Optional form accepted by parser:

  • Label before iterator variable: each "Label" item in collection
  • sleep after parallel: each item in items parallel 5 sleep 100

pipe

Streams or batches elements from a source through a body.

pipe chunk from chunks.chunks batch 20 parallel 3 do "Embed chunk" with text_embed text = chunk.text ->> embedded_stream

Collect mode:

pipe item from embedded_stream do "Normalize" with echo message = item.embedding -> normalized

Syntax:

pipe item from source_expr [batch expr] [parallel expr] ...body steps... -> binding

or:

->> stream_binding

check

Evaluates a condition and runs explicit pass/fail actions.

Expression-based condition:

check "Has results" count(final_results) > 0 on pass: continue on fail: fail "No results passed the cutoff"

LLM-evaluated condition:

check "Report completeness" ask llm "Does this report cover overview, architecture, strengths, weaknesses, and recommendations?" on pass: continue on fail: goto "Revision planning"

Allowed actions:

  • continue
  • goto "Branch or section label"
  • retry or retry N (default is 3)
  • fail "message" (default message allowed)

decide

Routes to branch bodies.

Rules strategy:

decide "Route by MIME" with rules when starts_with(probe.content_type, "image/") -> "Image" when starts_with(probe.content_type, "video/") -> "Video" otherwise -> "Binary" "Image": do "Process Image" with image_chunk url = url -> processed "Binary": emit "Binary Result" category = "binary"

LLM strategy:

decide "Choose architecture" with llm "Given constraints, choose one: microservices, monolith, serverless, hybrid" "microservices": do "Design microservices" with llm prompt = "Design microservices architecture" -> design "monolith": do "Design monolith" with llm prompt = "Design monolith architecture" -> design

together

Runs lanes in parallel-friendly structure.

together "Analyze in parallel" do "Extract entities" with llm prompt = "Extract entities from {text}" -> entities do "Summarize" with llm prompt = "Summarize {text}" -> summary -> discovery

Notes:

  • Blank lines separate lanes.
  • A lane itself can contain sequential steps.
  • Runtime has fast-path parallel execution constraints; see caveats page.

wait

Pauses execution for duration and/or until condition.

wait "Brief pause" duration = "100ms"
wait "Already ready" condition = ready == true timeout = "5s"

until = expr is accepted as alias for condition = expr.

repeat

Runs body until condition becomes true.

repeat "Gradient descent" let epoch = epoch + 1 let converged = improvement < convergence until converged or epoch >= max_epochs -> training_result

Optional max iterations:

repeat "Capped loop" let x = x + 1 until x > 9999 max 3 -> capped_result

Practical Guidance

  1. Prefer check for explicit gate behavior instead of embedding failure semantics into every do.
  2. Use decide ... with rules when branch criteria can be deterministic.
  3. Use pipe when you want stream-forward (->>) semantics between stages.
  4. Keep branch labels short and unique for easier watch/debug traces.