Actions API Reference
goapauto.models.actions.Action
Represents an atomic action the agent can take.
from goapauto.models.actions import Action, Increment
action = Action(
name="chop_wood",
preconditions={"has_axe": True},
effects={"wood": Increment(1)},
cost=1.0 # int or float (default: 1)
)
Methods
-
is_applicable(state: Any) -> boolReturnsTrueif the state meets allpreconditions. -
apply(state: Any) -> WorldStateReturns a newWorldStatewitheffectsapplied (immutable transition). -
async_apply(state: Any) -> WorldStateCoroutine version ofapplyfor async contexts.
Predicates & Effects
goapauto.models.actions.Predicate
Base class for conditions.
- Equal(value): Checks equality.
- GreaterThan(value): Checks state_val > value.
- LessThan(value): Checks state_val < value.
goapauto.models.actions.Effect
Base class for state mutations.
- Set(value): Sets attribute to value.
- Increment(amount=1): Adds amount.
- Decrement(amount=1): Subtracts amount.