AttractorEx.Outcome (attractor_phoenix v0.1.0)

Copy Markdown View Source

Standard result value returned by node handlers.

Outcomes tell the engine whether a stage succeeded, partially succeeded, failed, or should be retried. They also carry context updates and routing hints such as preferred_label and suggested_next_ids.

Summary

Functions

Builds a failure outcome with a reason and failure category.

Builds a partial-success outcome with optional context updates and notes.

Builds a retry outcome with a reason and retry category.

Builds a success outcome with optional context updates and notes.

Types

failure_category()

@type failure_category() :: :retryable | :terminal | :pipeline | nil

status()

@type status() :: :success | :partial_success | :fail | :retry

t()

@type t() :: %AttractorEx.Outcome{
  context_updates: map(),
  failure_category: failure_category(),
  failure_reason: String.t() | nil,
  notes: String.t() | nil,
  preferred_label: String.t() | nil,
  status: status(),
  suggested_next_ids: [String.t()]
}

Functions

fail(reason, category \\ :terminal)

Builds a failure outcome with a reason and failure category.

partial_success(updates \\ %{}, notes \\ nil)

Builds a partial-success outcome with optional context updates and notes.

retry(reason, category \\ :retryable)

Builds a retry outcome with a reason and retry category.

success(updates \\ %{}, notes \\ nil)

Builds a success outcome with optional context updates and notes.