# `Nous.Workflow.Node`
[🔗](https://github.com/nyo16/nous/blob/v0.17.1/lib/nous/workflow/node.ex#L1)

A node in a workflow graph.

Nodes represent discrete execution steps: running agents, executing tools,
branching on conditions, parallel fan-out, data transformation, and
human-in-the-loop checkpoints.

## Node Types

| Type | Purpose |
|------|---------|
| `:agent_step` | Run a `Nous.Agent` via `AgentRunner.run/3` |
| `:tool_step` | Execute a single tool via `ToolExecutor.execute/3` |
| `:branch` | Conditional routing based on state predicates |
| `:parallel` | Static fan-out to named branches, fan-in with merge |
| `:parallel_map` | Dynamic fan-out over a runtime-computed list |
| `:transform` | Pure function on workflow state |
| `:human_checkpoint` | Pause for human review/approval |
| `:subworkflow` | Nested workflow invocation |

## Examples

    Nous.Workflow.Node.new(%{
      id: "fetch_data",
      type: :agent_step,
      label: "Fetch research data",
      config: %{agent: researcher_agent, prompt: "Find data on..."}
    })

# `error_strategy`

```elixir
@type error_strategy() ::
  :fail_fast
  | {:retry, max :: pos_integer(), delay_ms :: non_neg_integer()}
  | :skip
  | {:fallback, node_id :: String.t()}
```

# `node_type`

```elixir
@type node_type() ::
  :agent_step
  | :tool_step
  | :branch
  | :parallel
  | :parallel_map
  | :transform
  | :human_checkpoint
  | :subworkflow
```

# `t`

```elixir
@type t() :: %Nous.Workflow.Node{
  config: map(),
  error_strategy: error_strategy(),
  id: String.t(),
  label: String.t(),
  metadata: map(),
  timeout: non_neg_integer() | nil,
  type: node_type()
}
```

# `new`

```elixir
@spec new(map()) :: t()
```

Create a new workflow node.

Required: `:id`, `:type`, and `:label`.

## Examples

    iex> node = Nous.Workflow.Node.new(%{id: "step1", type: :transform, label: "Clean data"})
    iex> node.type
    :transform
    iex> node.error_strategy
    :fail_fast

# `valid_types`

```elixir
@spec valid_types() :: [node_type()]
```

Returns the list of valid node types.

---

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