import { loop, doWhile, times, map } from "veryfront/workflow";
// Repeat while condition is true
loop("refine", (ctx) => ctx.results.review.score < 0.9, [
step("rewrite", { agent: "writer" }),
step("review", { agent: "reviewer" }),
])
// Execute once, then repeat while true
doWhile("poll", (ctx) => !ctx.results.check.done, [
step("check", { tool: "statusChecker" }),
delay("wait", "5s"),
])
// Fixed iterations
times("generate", 3, [
step("variant", { agent: "writer" }),
])
// Map over array items
map("process", (ctx) => ctx.input.urls, [
step("scrape", { tool: "webScraper" }),
])