local F = require("flow_dsl")
local flow = F.seq({
F.fanout({
items = F.p("$.d.targets"),
bind = F.p("$.item"),
join = "all",
out = F.p("$.results"),
body = F.step({ agent = "check", input = F.p("$.item"), out = F.p("$.branch_out") }),
}),
F.step({ agent = "aggregate", input = F.p("$.results"), out = F.p("$.aggregate") }),
})
return {
id = "sample-fanout",
flow = flow,
agents = {
{
name = "check",
kind = "operator",
spec = { operator_ref = "main-ai" },
profile = {
system_prompt = "Check the single target named in the input; reply with a one-paragraph report of what you found.",
tools = {},
},
runner = { backend = "ws_operator", variant = "claude", tools = {} },
},
{
name = "aggregate",
kind = "operator",
spec = { operator_ref = "main-ai" },
profile = {
system_prompt = "Read the array of per-lane checker results at `$.results` and produce a single overall verdict + one-paragraph summary.",
tools = {},
},
runner = { backend = "ws_operator", variant = "claude", tools = {} },
},
},
operators = {
{ name = "main-ai", kind = "main_ai" },
},
strategy = { strict_refs = true, strict_kind = true },
metadata = {
description = "One `check` agent fanned out over the `$.d.targets` array via F.fanout (join = \"all\"), one dispatch per item, with an aggregate stage consuming the collected `$.results`. The fanout body runs once per item, so it holds exactly one step. Seed with init_ctx={\"d\":{\"targets\":[\"core\",\"server\",\"cli\"]}}. Heterogeneous lanes (one agent per lane) are the `mse bp new fanout` scaffold's shape; see mse://guides/bp-dsl-templates. Gating on the result: mse://guides/blueprint-authoring.",
},
}