agents.planning.base.modelsΒΆ
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ΒΆ
Ultimate flexible plan supporting any content type with maximum intelligence. |
|
Intelligent base step with adaptive behavior and smart validation. |
|
Event representing a change in the planning structure. |
|
Conditional execution plan. |
|
Event system for tracking changes. |
|
Maximum flexibility plan - can contain anything. |
|
Advanced modifiable sequence with event system, undo/redo, and cycle detection. |
|
Advanced mixin with intelligent status management and auto-adaptation. |
|
Parallel execution plan. |
|
Priority levels with critical and emergency levels. |
|
Sequential execution plan. |
|
Ultimate task model with maximum intelligence and flexibility. |
|
Enhanced status enumeration with parallel execution support. |
|
Tree traversal patterns. |
Module ContentsΒΆ
- class agents.planning.base.models.BasePlan(**data)ΒΆ
Bases:
IntelligentStatusMixin
,Generic
[T
]Ultimate flexible plan supporting any content type with maximum intelligence.
Init .
- add_step(step)ΒΆ
Add any type of content as a step.
- Parameters:
step (PlanContent)
- Return type:
Self
- add_steps(steps)ΒΆ
Add multiple steps.
- Parameters:
steps (list[PlanContent])
- Return type:
Self
- async execute(mode=None)ΒΆ
Execute the plan using specified mode.
- find_by_id(item_id)ΒΆ
Find any item by ID recursively.
- Parameters:
item_id (str)
- Return type:
Any | None
- find_by_predicate(predicate)ΒΆ
Find all items matching predicate.
- Parameters:
predicate (collections.abc.Callable[[Any], bool])
- Return type:
list[Any]
- traverse(mode=TraversalMode.DEPTH_FIRST)ΒΆ
Traverse the plan tree using specified mode.
- Parameters:
mode (TraversalMode)
- Return type:
list[Any]
- class agents.planning.base.models.BaseStep(**data)ΒΆ
Bases:
IntelligentStatusMixin
Intelligent base step with adaptive behavior and smart validation.
Init .
- add_feedback(feedback, quality_score=None)ΒΆ
Add execution feedback.
- async execute()ΒΆ
Execute the step intelligently.
- Return type:
Any
- class agents.planning.base.models.ChangeEvent(/, **data)ΒΆ
Bases:
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.
- Parameters:
data (Any)
- class agents.planning.base.models.ConditionalPlanΒΆ
Bases:
BasePlan
[Union
[BaseStep
,BasePlan
,collections.abc.Callable
]]Conditional execution plan.
- class agents.planning.base.models.EventEmitterΒΆ
Event system for tracking changes.
Init .
- emit(event)ΒΆ
Emit an event.
- Parameters:
event (ChangeEvent)
- on(event_type, callback)ΒΆ
Register event listener.
- Parameters:
event_type (str)
callback (collections.abc.Callable)
- class agents.planning.base.models.FlexiblePlanΒΆ
Bases:
BasePlan
[PlanContent
]Maximum flexibility plan - can contain anything.
- class agents.planning.base.models.IntelligentSequence(items=None, parent=None)ΒΆ
Bases:
list
[PlanContent
],Generic
[T
]Advanced modifiable sequence with event system, undo/redo, and cycle detection.
Init .
- Parameters:
- append(item)ΒΆ
Add item with undo support and events.
- Parameters:
item (T)
- Return type:
None
- insert(index, item)ΒΆ
Insert item with undo support and events.
- Parameters:
index (int)
item (T)
- Return type:
None
- remove(item)ΒΆ
Remove item with undo support and events.
- Parameters:
item (T)
- Return type:
None
- class agents.planning.base.models.IntelligentStatusMixin(**data)ΒΆ
Bases:
pydantic.BaseModel
,abc.ABC
Advanced mixin with intelligent status management and auto-adaptation.
Init .
- update_status(new_status, propagate=True)ΒΆ
Update status with intelligent propagation.
- Parameters:
new_status (TaskStatus)
propagate (bool)
- Return type:
Self
- class agents.planning.base.models.ParallelPlanΒΆ
Bases:
BasePlan
[Union
[BaseStep
,BasePlan
]]Parallel execution plan.
- class agents.planning.base.models.PriorityΒΆ
-
Priority levels with critical and emergency levels.
Initialize self. See help(type(self)) for accurate signature.
- class agents.planning.base.models.SequentialPlanΒΆ
Bases:
BasePlan
[Union
[BaseStep
,BasePlan
]]Sequential execution plan.
- class agents.planning.base.models.Task(**data)ΒΆ
Bases:
IntelligentStatusMixin
Ultimate task model with maximum intelligence and flexibility.
Init .
- add_contingency(plan, trigger_condition)ΒΆ
Add contingency plan with trigger condition.
- class agents.planning.base.models.TaskStatusΒΆ
-
Enhanced status enumeration with parallel execution support.
Initialize self. See help(type(self)) for accurate signature.