# `Jido.Composer.Node.FanOutNode`
[🔗](https://github.com/lostbean/jido_composer/blob/main/lib/jido/composer/node/fan_out_node.ex#L1)

Executes multiple child nodes concurrently and merges their results.

FanOutNode encapsulates parallel execution behind the standard Node interface.
It appears as a single state to the Workflow FSM but internally spawns
multiple branches via `Task.async_stream`.

## Merge Strategies

- `:deep_merge` (default) — scopes each branch result under the branch name,
  then deep-merges into a single map
- Custom function — receives `[{branch_name, result}]` and returns a map

## Error Handling

- `:fail_fast` (default) — returns `{:error, reason}` on first branch failure
- `:collect_partial` — collects all results, including `{:error, reason}` entries

# `branch`

```elixir
@type branch() :: {atom(), struct()}
```

# `merge`

```elixir
@type merge() :: :deep_merge | ([{atom(), map()}] -&gt; map())
```

# `t`

```elixir
@type t() :: %Jido.Composer.Node.FanOutNode{
  branches: [branch()],
  max_concurrency: pos_integer() | nil,
  merge: merge(),
  name: String.t(),
  on_error: :fail_fast | :collect_partial,
  timeout: pos_integer() | :infinity
}
```

# `merge_results`

```elixir
@spec merge_results(%{required(atom()) =&gt; term()} | [{atom(), term()}], merge()) ::
  map()
```

Merges branch results using the specified merge strategy.

Delegates to `FanOut.State.do_merge/2` — the single source of truth for
all merge strategies (`:deep_merge`, `:ordered_list`, custom functions).

# `new`

```elixir
@spec new(keyword()) :: {:ok, t()} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
