2.5 KiB
08.1 — run_parallel_fanout → graph::parallel::map_reduce
The crate now has the ordered/bounded map-reduce helper the OpenHuman
helper was written to fill (ParallelOptions, FailurePolicy,
per-item ItemOutcome, cancellation).
Current status (2026-07-02): landed. Live fanout callers now invoke
tinyagents::graph::parallel::map_reduce directly: spawn_parallel_agents,
workflow phase fanout (workflow_runs/engine.rs), and model_council fanout.
tinyagents/orchestration.rs::run_parallel_fanout has been removed. The
remaining TaskStore re-export seam is crate-internal for detached-subagent
lifecycle bookkeeping. Workflow phase fanout now shares the durable workflow
stop signal with ParallelOptions::with_cancellation, so SDK cancellation maps
back to the existing Interrupted run state. Usage-rollup parity has direct
coverage in turn_subagent_usage::map_reduce_fanout_preserves_scope: TinyAgents
1.3.0 map_reduce drives bounded futures through buffer_unordered and
reorders in the same async call path, so OpenHuman's tokio task-local
parent-turn collector stays visible to inline spawn_parallel_agents workers.
Steps
- Done: compare
tinyagents/orchestration.rs::run_parallel_fanoutsemantics (input-order results, bounded concurrency, take-once payload cell, graph events) withmap_reduce. - Done: re-point callers:
spawn_parallel_agents, workflow phase intra-phase fanout (workflow_runs/engine.rs), model_council fanout. - Done: preserve the task-local usage-collector behavior. The direct
turn_subagent_usage::map_reduce_fanout_preserves_scoperegression proves records made insidemap_reduceworkers still roll into the active parent turn collector. The longer-term 06-cost work can replace this task-local bridge withUsageTotals/ChildRunlineage once lineage parity lands. - Done: choose
FailurePolicyper caller (council = collect-all; workflow phase = fail-fast or per-phase config). Use the 1.3.0 options:with_item_timeout/with_total_timeout/with_cancellation(a per-item timeout is behavior the old helper never had — set it deliberately per caller, not by default). Workflow phase fanout now useswith_cancellation; timeout policy remains unset by design.
Deletions
run_parallel_fanout+ the move-once cell machinery intinyagents/orchestration.rs(file keeps the TaskStore re-exports until 07.2 relocates them).
Acceptance
- Deterministic input-order results with out-of-order completion; task-local usage rollup parity on a fanout turn.