Flow controls
← Relifold documentationUnfold
Apply a transformation recursively under explicit stopping bounds.
Unfold repeatedly applies one deterministic or semantic Transform to generated
values in the same Space. Use it for bounded recursive expansion, not for an ordinary linear
pipeline.
expand = SemTransform(
name="expand-topic",
input_spaces=("topics",),
output_space="topics",
primary_key="topic",
prompt=(
"Return the immediate subtopics as children. Return an empty list when "
"the topic should not be divided further."
),
emits=("children",),
provider="openai",
model="gpt-5",
reasoning_effort="low",
)
Unfold(
name="expand-topic-tree",
body=expand,
emits="list",
field="children",
stop=Stop(max_depth=4, max_nodes=500),
)| Parameter | Default | Meaning |
|---|---|---|
body | required | A Transform or SemTransform whose input and output Space match. |
emits | list | Whether each expansion returns a list or one next value. |
field | children / next | The output field containing generated values. |
stop.sentinel | none | Optional leaf token that ends one branch. |
stop.max_depth | 10 | Maximum recursive depth. |
stop.max_nodes | unlimited | Maximum generated values across the expansion. |
Bound recursive work
Always choose depth and node limits that match the expected output. These limits protect the session from an unexpectedly expansive transformation and make cost expectations reviewable.