Jido.BehaviorTree.Nodes.Sequence (Jido Behavior Tree v1.0.0)

View Source

A composite node that executes children in sequence.

The Sequence node executes each child in order. If all children succeed, the sequence succeeds. If any child fails, the sequence fails immediately. If a child returns running, the sequence returns running and will resume from that child on the next tick.

Example

sequence = Sequence.new([
  CheckCondition.new(),
  PerformAction.new(),
  LogResult.new()
])

Summary

Functions

Creates a new Sequence node with the given children.

Returns the Zoi schema for this module

Context-aware tick that threads the tick through child nodes.

Types

t()

@type t() :: %Jido.BehaviorTree.Nodes.Sequence{
  children: [any()],
  current_index: integer()
}

Functions

new(children)

@spec new([Jido.BehaviorTree.Node.t()]) :: t()

Creates a new Sequence node with the given children.

Examples

iex> Sequence.new([node1, node2, node3])
%Sequence{children: [node1, node2, node3], current_index: 0}

schema()

Returns the Zoi schema for this module

tick_with_context(state, tick)

Context-aware tick that threads the tick through child nodes.

Used by Tree.tick_with_context/2 to ensure agent state and directives are properly accumulated as children execute.