agents.planning.models.baseΒΆ
Base models for the unified planning system.
This module provides the foundation for a flexible planning system that can support various planning patterns including Plan-and-Execute, ReWOO, LLM Compiler, FLARE RAG, and recursive planning capabilities.
Key Design Principles: 1. Composable: Different planning patterns can mix and match components 2. Extensible: Easy to add new step types and planning patterns 3. Type-safe: Comprehensive validation and type checking 4. Resource-aware: Built-in support for resource tracking and constraints
ClassesΒΆ
Step that performs a specific action or tool call. |
|
Plan that can adapt during execution (FLARE style). |
|
Base class for all planning patterns. |
|
Base class for all planning steps. |
|
Step with conditional execution paths. |
|
Plan with explicit DAG structure (LLM Compiler style). |
|
Represents a dependency between steps. |
|
Type of dependency between steps. |
|
How a step should be executed. |
|
Container for steps that can execute in parallel. |
|
Step that can spawn sub-plans recursively. |
|
Step for information gathering and research. |
|
Traditional sequential execution plan. |
|
Metadata for tracking step execution and debugging. |
|
Universal status for any plan step. |
|
Type of plan step - extensible for different planning patterns. |
Module ContentsΒΆ
- class agents.planning.models.base.ActionStep(/, **data)ΒΆ
Bases:
BaseStep
Step that performs a specific action or tool call.
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.models.base.AdaptivePlan(/, **data)ΒΆ
Bases:
BasePlan
Plan that can adapt during execution (FLARE style).
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)
- adapt(context)ΒΆ
Adapt plan based on execution context.
- class agents.planning.models.base.BasePlan(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Base class for all planning patterns.
This provides core planning functionality while allowing different planning strategies to extend and customize behavior.
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)
- add_step(step)ΒΆ
Add a step to the plan.
- Parameters:
step (AnyStep)
- Return type:
None
- get_execution_order()ΒΆ
Get steps organized by execution order (batches for parallel execution).
- update_ready_steps()ΒΆ
Update and return steps that are ready to execute.
- Return type:
list[AnyStep]
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.planning.models.base.BaseStep(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Base class for all planning steps.
This provides the core functionality that all step types share, while being flexible enough to support various planning patterns.
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)
- add_dependency(step_id, dependency_type=DependencyType.HARD, condition=None, required_output=None)ΒΆ
Add a dependency to this step.
- Parameters:
step_id (str)
dependency_type (DependencyType)
condition (str | None)
required_output (str | None)
- Return type:
None
- is_ready(completed_steps)ΒΆ
Check if all dependencies are satisfied.
- mark_completed(output=None)ΒΆ
Mark step as completed.
- mark_in_progress()ΒΆ
Mark step as in progress.
- Return type:
None
- mark_ready()ΒΆ
Mark step as ready to execute.
- Return type:
None
- classmethod validate_unique_dependencies(v)ΒΆ
Ensure no duplicate dependencies.
- Parameters:
v (list[Dependency])
- Return type:
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.planning.models.base.ConditionalStep(/, **data)ΒΆ
Bases:
BaseStep
Step with conditional execution paths.
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.models.base.DAGPlan(/, **data)ΒΆ
Bases:
BasePlan
Plan with explicit DAG structure (LLM Compiler style).
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.models.base.Dependency(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Represents a dependency between steps.
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.models.base.DependencyTypeΒΆ
-
Type of dependency between steps.
Initialize self. See help(type(self)) for accurate signature.
- class agents.planning.models.base.ExecutionModeΒΆ
-
How a step should be executed.
Initialize self. See help(type(self)) for accurate signature.
- class agents.planning.models.base.ParallelStep(/, **data)ΒΆ
Bases:
BaseStep
Container for steps that can execute in parallel.
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.models.base.RecursiveStep(/, **data)ΒΆ
Bases:
BaseStep
Step that can spawn sub-plans recursively.
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.models.base.ResearchStep(/, **data)ΒΆ
Bases:
BaseStep
Step for information gathering and research.
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.models.base.SequentialPlan(/, **data)ΒΆ
Bases:
BasePlan
Traditional sequential execution plan.
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.models.base.StepMetadata(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Metadata for tracking step execution and debugging.
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.models.base.StepStatusΒΆ
-
Universal status for any plan step.
Initialize self. See help(type(self)) for accurate signature.