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_sourcesWith 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_resultsOptional form accepted by parser:
- Label before iterator variable:
each "Label" item in collection sleepafterparallel: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_streamCollect mode:
pipe item from embedded_stream
do "Normalize" with echo
message = item.embedding
-> normalizedSyntax:
pipe item from source_expr [batch expr] [parallel expr]
...body steps...
-> bindingor:
->> stream_bindingcheck
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:
continuegoto "Branch or section label"retryorretry 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"
-> designtogether
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
-> discoveryNotes:
- 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_resultOptional max iterations:
repeat "Capped loop"
let x = x + 1
until x > 9999
max 3
-> capped_resultPractical Guidance
- Prefer
checkfor explicit gate behavior instead of embedding failure semantics into everydo. - Use
decide ... with ruleswhen branch criteria can be deterministic. - Use
pipewhen you want stream-forward (->>) semantics between stages. - Keep branch labels short and unique for easier watch/debug traces.