Source:
Local role: Strategy node anchoring one action and its input perceived state to an ordered list of outcome branches. Each branch carries its own projected successor perceived state.
Big-picture role: Primary strategy-chain unit. A node says “apply this action from this perceived state; each outcome branch records the resulting projected successor perceived state and optionally chains to a child node.”
Inheritance:
- dataclass
Parameters and fields:
- node_id: str
- action_id: str
- source_perception_id: Optional[str]
- outcome_branches: list[StrategyOutcomeBranch]
- metadata: dict
Methods:
to_dict() -> dictfrom_dict(data) -> StrategyNode
Important behavior:
- projected outcomes live on each StrategyOutcomeBranch, not on the node itself
validate_tree()on Strategy enforces that each branch’sprojected_state, when present, must have been generated by the parent node’saction_id- when a branch links to a child node and carries a
projected_state,validate_tree()further enforces that the child node’ssource_perception_idequals the branch’s projected perception id
Example:
from ometeotl_core.model.strategies import StrategyNode, StrategyOutcomeBranch
branch = StrategyOutcomeBranch(
branch_id="branch-1",
label="success",
probability=0.9,
)
node = StrategyNode(
node_id="node-1",
action_id="action-1",
source_perception_id="perception-1",
outcome_branches=[branch],
)
data = node.to_dict()
node2 = StrategyNode.from_dict(data)
See also:
