langgoap.GoalPolicy#
- class GoalPolicy(replan_strategy=ReplanStrategy.ON_DEVIATION, priority=0, max_replans=10, on_infeasible='fail', blacklist_fallback=False)[source]#
Replanning + multi-goal-priority policy for a
GoalSpec.Grouping these three orthogonal-to-the-conditions knobs into a sub-dataclass keeps the
GoalSpecconstructor focused on what the goal is, not how the planner should chase it.- Parameters:
replan_strategy (ReplanStrategy)
priority (int)
max_replans (int)
on_infeasible (Literal['fail', 'execute'])
blacklist_fallback (bool)
- replan_strategy#
When the observer should trigger replanning during execution.
- priority#
Multi-goal scenarios use this to break ties when
MultiGoalchooses the next sub-goal. Higher = more important.- Type:
int
- max_replans#
Maximum number of replanning cycles before the observer gives up. Guards against infinite replan loops when an action keeps failing or the world state never converges. Set to
0to disable the limit.- Type:
int
- on_infeasible#
What the planner does when the best plan it can find violates a hard constraint (CSP status
INFEASIBLE)."fail"(default) rejects the plan: the run ends withstatus="no_plan"and ano_plan_explanationcarrying the resource shortfalls, so stuck handlers can relax the constraint."execute"keeps the pre-0.2 advisory behaviour and runs the plan anyway; the violation stays visible inplan.metadata.csp.- Type:
Literal[‘fail’, ‘execute’]
- blacklist_fallback#
When every path to the goal needs a blacklisted action,
Truelets the planner retry with the full action set (re-admitting the failed action) and clear the blacklist.False(default) reportsno_planso a permanently failing, human-denied, or guard-blocked action is never re-run; useActionSpec.max_retriesor anActionQosfor transient failures.- Type:
bool
- __init__(replan_strategy=ReplanStrategy.ON_DEVIATION, priority=0, max_replans=10, on_infeasible='fail', blacklist_fallback=False)#
- Parameters:
replan_strategy (ReplanStrategy)
priority (int)
max_replans (int)
on_infeasible (Literal['fail', 'execute'])
blacklist_fallback (bool)
- Return type:
None
Methods
__init__([replan_strategy, priority, ...])from_dict(data)Reconstruct from the dict produced by
to_dict().to_dict()Serialise to a JSON-native dict (inverse of
from_dict()).Attributes