haive.agents.planning.base.models ================================= .. py:module:: haive.agents.planning.base.models .. autoapi-nested-parse:: Planning Base Models - Advanced planning system with generics, indexing, and intelligent tree structures. This module provides a sophisticated planning framework with: - Maximum flexibility generics: Plan[Union[Step, Plan, Callable, str, Any]] - Intelligent tree traversal with cycle detection - Event-driven modifiable sequences with undo/redo - Auto-propagating status management - Smart field validation and auto-completion - Dynamic model adaptation based on content Classes ------- .. autoapisummary:: haive.agents.planning.base.models.BasePlan haive.agents.planning.base.models.BaseStep haive.agents.planning.base.models.ChangeEvent haive.agents.planning.base.models.ConditionalPlan haive.agents.planning.base.models.EventEmitter haive.agents.planning.base.models.FlexiblePlan haive.agents.planning.base.models.IntelligentSequence haive.agents.planning.base.models.IntelligentStatusMixin haive.agents.planning.base.models.ParallelPlan haive.agents.planning.base.models.Priority haive.agents.planning.base.models.SequentialPlan haive.agents.planning.base.models.Task haive.agents.planning.base.models.TaskStatus haive.agents.planning.base.models.TraversalMode Module Contents --------------- .. py:class:: BasePlan(**data) Bases: :py:obj:`IntelligentStatusMixin`, :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Ultimate flexible plan supporting any content type with maximum intelligence. Init . .. py:method:: add_step(step) Add any type of content as a step. .. py:method:: add_steps(steps) Add multiple steps. .. py:method:: execute(mode = None) :async: Execute the plan using specified mode. .. py:method:: find_by_id(item_id) Find any item by ID recursively. .. py:method:: find_by_predicate(predicate) Find all items matching predicate. .. py:method:: get_statistics() Get comprehensive plan statistics. .. py:method:: traverse(mode = TraversalMode.DEPTH_FIRST) Traverse the plan tree using specified mode. .. py:property:: completed_items :type: int Count completed items recursively. .. py:property:: complexity_score :type: float Calculate overall plan complexity. .. py:property:: next_executable_items :type: list[BaseStep | BasePlan] Find all items ready for execution (supports parallel). .. py:property:: progress_percentage :type: float Intelligent progress calculation. .. py:property:: total_steps :type: int Recursively count all executable items. .. py:class:: BaseStep(**data) Bases: :py:obj:`IntelligentStatusMixin` Intelligent base step with adaptive behavior and smart validation. Init . .. py:method:: add_feedback(feedback, quality_score = None) Add execution feedback. .. py:method:: execute() :async: Execute the step intelligently. .. py:property:: complexity_score :type: float Calculate complexity score based on various factors. .. py:property:: is_executable :type: bool Intelligent executability check. .. py:property:: readiness_score :type: float Calculate how ready this step is for execution. .. py:class:: ChangeEvent(/, **data) Bases: :py:obj:`pydantic.BaseModel` Event representing a change in the planning structure. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:class:: ConditionalPlan Bases: :py:obj:`BasePlan`\ [\ :py:obj:`Union`\ [\ :py:obj:`BaseStep`\ , :py:obj:`BasePlan`\ , :py:obj:`collections.abc.Callable`\ ]\ ] Conditional execution plan. .. py:class:: EventEmitter Event system for tracking changes. Init . .. py:method:: emit(event) Emit an event. .. py:method:: on(event_type, callback) Register event listener. .. py:class:: FlexiblePlan Bases: :py:obj:`BasePlan`\ [\ :py:obj:`PlanContent`\ ] Maximum flexibility plan - can contain anything. .. py:class:: IntelligentSequence(items = None, parent = None) Bases: :py:obj:`list`\ [\ :py:obj:`PlanContent`\ ], :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Advanced modifiable sequence with event system, undo/redo, and cycle detection. Init . :param items: [TODO: Add description] :param parent: [TODO: Add description] .. py:method:: append(item) Add item with undo support and events. .. py:method:: insert(index, item) Insert item with undo support and events. .. py:method:: pop(index = -1) Pop item with undo support and events. .. py:method:: redo() Redo last undone operation. .. py:method:: remove(item) Remove item with undo support and events. .. py:method:: undo() Undo last operation. .. py:class:: IntelligentStatusMixin(**data) Bases: :py:obj:`pydantic.BaseModel`, :py:obj:`abc.ABC` Advanced mixin with intelligent status management and auto-adaptation. Init . .. py:method:: update_status(new_status, propagate = True) Update status with intelligent propagation. .. py:class:: ParallelPlan Bases: :py:obj:`BasePlan`\ [\ :py:obj:`Union`\ [\ :py:obj:`BaseStep`\ , :py:obj:`BasePlan`\ ]\ ] Parallel execution plan. .. py:class:: Priority Bases: :py:obj:`str`, :py:obj:`enum.Enum` Priority levels with critical and emergency levels. Initialize self. See help(type(self)) for accurate signature. .. py:class:: SequentialPlan Bases: :py:obj:`BasePlan`\ [\ :py:obj:`Union`\ [\ :py:obj:`BaseStep`\ , :py:obj:`BasePlan`\ ]\ ] Sequential execution plan. .. py:class:: Task(**data) Bases: :py:obj:`IntelligentStatusMixin` Ultimate task model with maximum intelligence and flexibility. Init . .. py:method:: activate_plan(plan) Intelligently activate a plan. .. py:method:: add_contingency(plan, trigger_condition) Add contingency plan with trigger condition. .. py:method:: execute() :async: Execute the primary plan intelligently. .. py:method:: get_comprehensive_status() Get comprehensive status across all plans. .. py:property:: is_complete :type: bool Intelligent completion check. .. py:property:: overall_complexity :type: float Calculate overall task complexity. .. py:property:: overall_progress :type: float Calculate progress across all active plans. .. py:class:: TaskStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` Enhanced status enumeration with parallel execution support. Initialize self. See help(type(self)) for accurate signature. .. py:class:: TraversalMode Bases: :py:obj:`str`, :py:obj:`enum.Enum` Tree traversal patterns. Initialize self. See help(type(self)) for accurate signature.