Nous.Decisions.Node (nous v0.15.6)

View Source

A node in the decision graph.

Nodes represent discrete elements of an agent's decision-making process: goals, decisions, options, actions, outcomes, observations, and revisits.

Architecture

Nodes are plain structs with auto-generated IDs and timestamps. They are stored in a Nous.Decisions.Store backend and connected by Nous.Decisions.Edge structs to form a directed graph.

Quick Start

node = Nous.Decisions.Node.new(%{
  type: :goal,
  label: "Implement authentication",
  confidence: 0.9
})

Fields

FieldTypeDescription
idString.t()Unique identifier (auto-generated)
typenode_type()Category of this node
labelString.t()Human-readable description
statusstatus()Current lifecycle status
confidencefloat() | nilAgent's confidence level 0.0-1.0
metadatamap()Arbitrary key-value data
rationaleString.t() | nilExplanation for this node's existence or state
created_atDateTime.t()When the node was created
updated_atDateTime.t()When the node was last modified

Summary

Functions

Create a new node with auto-generated ID and timestamps.

Types

node_type()

@type node_type() ::
  :goal | :decision | :option | :action | :outcome | :observation | :revisit

status()

@type status() :: :active | :completed | :superseded | :rejected

t()

@type t() :: %Nous.Decisions.Node{
  confidence: float() | nil,
  created_at: DateTime.t(),
  id: String.t(),
  label: String.t(),
  metadata: map(),
  rationale: String.t() | nil,
  status: status(),
  type: node_type(),
  updated_at: DateTime.t()
}

Functions

new(attrs)

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

Create a new node with auto-generated ID and timestamps.

Options

All fields except :id, :created_at, and :updated_at can be provided. Required: :type and :label.

Examples

iex> node = Nous.Decisions.Node.new(%{type: :goal, label: "Ship v1.0"})
iex> node.type
:goal
iex> node.status
:active
iex> is_binary(node.id)
true