Nous.Workflow.Engine.Executor (nous v0.16.1)

View Source

Per-node execution dispatch.

Routes node execution to the appropriate handler based on node type. Each handler receives the node and current workflow state, and returns {:ok, result, updated_state} or {:error, reason}.

Phase 1 Node Types

  • :agent_step — runs a Nous.Agent via AgentRunner.run/3
  • :tool_step — executes a tool via ToolExecutor.execute/3
  • :transform — applies a pure function to the state

Later Phases

  • :branch — conditional routing (Phase 2)
  • :parallel / :parallel_map — fan-out (Phase 3)
  • :human_checkpoint — HITL pause (Phase 2)
  • :subworkflow — nested workflow (Phase 5)

Summary

Functions

Execute a single node with the current workflow state.

Execute a node with additional graph context (needed for :parallel nodes).

Functions

execute(node, state)

@spec execute(Nous.Workflow.Node.t(), Nous.Workflow.State.t()) ::
  {:ok, term(), Nous.Workflow.State.t()} | {:error, term()}

Execute a single node with the current workflow state.

Returns {:ok, result, updated_state} or {:error, reason}.

execute(node, state, graph_nodes)

@spec execute(Nous.Workflow.Node.t(), Nous.Workflow.State.t(), map()) ::
  {:ok, term(), Nous.Workflow.State.t()} | {:error, term()}

Execute a node with additional graph context (needed for :parallel nodes).