StrategyOutcomeBranch

Source:

Local role: One outcome branch leaving a StrategyNode toward an optional child node. Carries the projected successor perceived state produced by the parent node’s action.

Big-picture role: Strategy tree edge that encodes the projected outcome of one action execution: its successor perceived state, probability, condition labels, and child-node reference. One action can now produce several distinct outcomes across sibling branches.

Inheritance:

  • dataclass

Parameters and fields:

  • branch_id: str
  • label: str
  • child_node_id: Optional[str]
  • projected_state: Optional[ProjectedPerceptionState]
  • probability: Optional[float]
  • condition: dict
  • metadata: dict

Methods:

  • to_dict() -> dict
  • from_dict(data) -> StrategyOutcomeBranch

Important behavior:

  • if projected_state is present, validate_tree() on Strategy enforces that its generating_action_id matches the parent node’s action_id
  • terminal branches (no child_node_id) may still carry a projected_state to expose the final successor perception to utility evaluation
  • probability must be in [0, 1] when set

Example:

from ometeotl_core.model.strategies import StrategyOutcomeBranch

# Terminal branch (no child): carries the projected final state
success_branch = StrategyOutcomeBranch(
    branch_id="branch-success",
    label="success",
    probability=0.8,
    condition={"resource_available": True},
    projected_state=projected_perception_state,
)

# Non-terminal branch: links to the next node
continue_branch = StrategyOutcomeBranch(
    branch_id="branch-continue",
    label="partial",
    child_node_id="node-2",
    probability=0.2,
)

data = success_branch.to_dict()

See also:

Ometeotl

A Python library to build complex multi-agent simulations, wargames, and AI-driven strategies