agents.planning.enhanced_plan_execute_v5.planner.models

Planner Models - Custom Pydantic models for strategic planning.

This module defines the structured output models used by the planner agent for creating comprehensive, actionable task plans.

Classes

PlanningContext

Context information for the planner agent.

TaskPlan

Comprehensive task plan with metadata and execution strategy.

TaskStep

Individual step in a task plan with rich metadata.

Module Contents

class agents.planning.enhanced_plan_execute_v5.planner.models.PlanningContext(/, **data)

Bases: pydantic.BaseModel

Context information for the planner agent.

Provides additional context that helps the planner create better, more targeted plans based on available resources and constraints.

Parameters:

data (Any)

available_tools

Tools that can be used during execution

time_constraints

Any time limitations to consider

complexity_level

Desired complexity level for the plan

domain_focus

Specific domain or area of focus

previous_attempts

Information about previous planning attempts

Examples

Research context:

context = PlanningContext(
    available_tools=["web_search", "calculator", "document_reader"],
    time_constraints="Complete within 1 hour",
    complexity_level="detailed",
    domain_focus="financial_analysis"
)

Simple task context:

context = PlanningContext(
    available_tools=["calculator"],
    complexity_level="simple",
    domain_focus="mathematics"
)

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.

class agents.planning.enhanced_plan_execute_v5.planner.models.TaskPlan(/, **data)

Bases: pydantic.BaseModel

Comprehensive task plan with metadata and execution strategy.

Represents a complete strategic plan for accomplishing a complex objective, including all steps, reasoning, and success criteria.

Parameters:

data (Any)

objective

The main goal we’re trying to achieve

steps

Ordered list of steps to execute

reasoning

Explanation of the planning approach

success_criteria

How we’ll know the objective is achieved

estimated_total_time

Total estimated time for all steps

plan_type

Type of planning strategy used

risk_factors

Potential risks and mitigation strategies

Examples

Research plan:

plan = TaskPlan(
    objective="Research Tesla's Q4 2024 financial performance",
    steps=[search_step, analysis_step, summary_step],
    reasoning="Sequential approach: gather data, analyze, summarize",
    success_criteria="Complete financial overview with key metrics",
    plan_type="sequential_research"
)

Complex analysis plan:

plan = TaskPlan(
    objective="Compare renewable energy adoption across countries",
    steps=[data_steps, comparison_steps, visualization_step],
    reasoning="Parallel data gathering followed by comparative analysis",
    success_criteria="Comprehensive comparison with visual insights",
    plan_type="comparative_analysis",
    risk_factors=["Data availability", "Currency conversion accuracy"]
)

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.

class agents.planning.enhanced_plan_execute_v5.planner.models.TaskStep(/, **data)

Bases: pydantic.BaseModel

Individual step in a task plan with rich metadata.

Represents a single actionable step within a larger plan, including all the information needed for successful execution.

Parameters:

data (Any)

step_id

Unique identifier for tracking this step

description

Clear, actionable description of what to do

expected_outcome

What result this step should produce

tools_needed

Tools required for execution

priority

Execution priority level

estimated_time

Estimated completion time

dependencies

Steps that must complete before this one

Examples

Basic step:

step = TaskStep(
    step_id="step_1",
    description="Search for current stock price of AAPL",
    expected_outcome="Current AAPL stock price in USD",
    tools_needed=["web_search"],
    priority="high"
)

Step with dependencies:

step = TaskStep(
    step_id="step_2",
    description="Calculate percentage change from yesterday",
    expected_outcome="Percentage change calculation",
    tools_needed=["calculator"],
    dependencies=["step_1"],
    priority="medium"
)

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.