Template: fan_out_aggregate
Plan work, fan out independent branches, then aggregate with a fan-in budget.
Item |
Value |
|---|---|
Name |
|
Module |
|
Class |
|
Version |
|
When to use
Parallel research or multi-path exploration
Map-style work that must join before continuing
Any fan-out where write-scope conflicts should serialize at reduce time
Topology
plan → branch_0 … branch_N → reduce
Edges: plan --control→ branch_*, branch_* --data→ reduce.
Soft points
Name |
Kind |
Default |
Notes |
|---|---|---|---|
|
runner_kind |
|
Planning step runner |
|
runner_kind |
|
Per-branch runner |
|
runner_kind |
|
Aggregation runner |
|
task_state |
|
Via |
|
budget |
|
Stored on reduce payload |
|
policy |
|
Attached to reduce |
Example
from mechaharness.graph_templates import (
FanOutAggregateTemplate,
GraphTemplateParams,
)
graph = FanOutAggregateTemplate().instantiate(
GraphTemplateParams(
goal="compare two drafts",
branch_payloads=[
{"index": 0, "source": "a"},
{"index": 1, "source": "b", "write_scopes": ["draft"]},
],
soft_bindings={"fan_in_budget": 4, "branch_kind": "research_branch"},
acceptance=["merged"],
)
)
assert list(graph.nodes) == ["plan", "branch_0", "branch_1", "reduce"]
Tests
Fixture cases under tests/fixtures/graph_templates/ (ids prefixed
fan_out_aggregate_*) exercise topology and soft-point overrides with static
Pydantic models — no live inference.