Jido. Agent. Strategy. BehaviorTree
(Jido Behavior Tree v1.0.0)
View Source
Behavior tree execution strategy for Jido agents.
This strategy allows agents to use behavior trees for decision-making.
Each cmd/3 call executes exactly one behavior tree tick, making execution
bounded and predictable.
Configuration
Configure via strategy options when defining an agent:
defmodule MyAgent do
use Jido.Agent,
name: "bt_agent",
strategy: {Jido.Agent.Strategy.BehaviorTree,
tree: my_tree(),
blackboard: %{initial: "data"}
}
endOptions
:tree- AJido.BehaviorTree.Tree.t()(required unless:tree_builderprovided):tree_builder-{mod, fun, args}to build tree dynamically per agent:blackboard- Initial blackboard data map (default:%{}):reset_on_completion- Reset tree when status is:successor:failure(default:false)
Execution Model
init/2- Creates tree and blackboard from options, stores in__strategy__cmd/3- Injects instructions into blackboard, runs one tree tick, returns directivessnapshot/2- Maps tree status toStrategy.Snapshot
Status Mapping
- Tree
:success→ Snapshot:success - Tree
:failure→ Snapshot:failure - Tree
:running→ Snapshot:running - Before first tick → Snapshot
:idle