Nous.Workflow.Node (nous v0.13.3)

View Source

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

TypePurpose
:agent_stepRun a Nous.Agent via AgentRunner.run/3
:tool_stepExecute a single tool via ToolExecutor.execute/3
:branchConditional routing based on state predicates
:parallelStatic fan-out to named branches, fan-in with merge
:parallel_mapDynamic fan-out over a runtime-computed list
:transformPure function on workflow state
:human_checkpointPause for human review/approval
:subworkflowNested 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

Functions

Create a new workflow node.

Returns the list of valid node types.

Types

error_strategy()

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

node_type()

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

t()

@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

new(attrs)

@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()

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

Returns the list of valid node types.