Nous.Workflow.Engine.StateMerger (nous v0.16.0)

View Source

Merge strategies for combining parallel branch results back into workflow state.

After parallel branches complete, their results need to be merged into a single state. Three built-in strategies are provided:

  • :deep_merge — deep-merges all branch result maps into state.data
  • :list_collect — collects branch results into a list under a key
  • Custom function — fn branch_results, state -> updated_state

Summary

Functions

Merge parallel branch results into the workflow state.

Types

strategy()

@type strategy() ::
  :deep_merge
  | :list_collect
  | (list(), Nous.Workflow.State.t() -> Nous.Workflow.State.t())

Functions

merge(results, state, strategy, opts \\ [])

Merge parallel branch results into the workflow state.

Parameters

  • results — list of {branch_id, result} tuples from completed branches
  • state — current workflow state
  • strategy — merge strategy atom or custom function
  • opts — additional options (:result_key for :list_collect)