Nous.Workflow.Node (nous v0.13.3)
View SourceA 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..."}
})
Summary
Types
@type error_strategy() :: :fail_fast | {:retry, max :: pos_integer(), delay_ms :: non_neg_integer()} | :skip | {:fallback, node_id :: String.t()}
@type node_type() ::
:agent_step
| :tool_step
| :branch
| :parallel
| :parallel_map
| :transform
| :human_checkpoint
| :subworkflow
@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() }
Functions
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
@spec valid_types() :: [node_type()]
Returns the list of valid node types.