langgoap.pipeline_plan

Contents

langgoap.pipeline_plan#

pipeline_plan(start, goal, actions, blacklisted_actions=None, *, max_alternatives=5, tracer=None, record_expansions=False)#

Two-phase planning: A* finds sequences, CSP validates/optimizes.

Parameters:
  • start (PlanningState | dict[str, Any]) – Current world state. Accepts a plain dict for convenience; it will be coerced to PlanningState internally.

  • goal (GoalSpec) – Goal specification with target conditions, constraints, objectives.

  • actions (list[ActionSpec]) – Available actions.

  • blacklisted_actions (list[str] | None) – Action names to exclude.

  • max_alternatives (int) – Maximum number of alternative plans to generate when the primary plan fails CSP validation.

  • tracer (Any) – Optional PlanningTracer whose on_search_expand / on_search_dead_end hooks receive primary-search expansions and pipeline-level dead-end events (e.g. csp_infeasible). The pipeline owns a single on_search_complete emission for the logical plan call — alternative-enumeration A* runs do not re-emit completions.

  • record_expansions (bool) – Opt-in gate for the per-expansion firehose. Must be True and a tracer supplied for any hook to fire.

Returns:

A Plan with metadata.csp attached. When CSP finds the primary plan feasible it is returned directly. When all alternatives are also infeasible the primary plan is returned with CSPStatus.INFEASIBLE metadata — the CSP layer is advisory and does not block graph execution; inspect plan.metadata.csp.status to decide whether to proceed. Returns None only when A* cannot find any plan at all.

Return type:

Plan | None