agents.planning_v2.base.modelsΒΆ

Data models for planning agents.

This module contains Pydantic models for planning agent configurations, plans, steps, and other planning-related data structures.

ClassesΒΆ

Plan

Generic plan model that can work with any step type.

Status

Status for tasks and plans.

Task

Simple task model.

Module ContentsΒΆ

class agents.planning_v2.base.models.Plan(/, **data)ΒΆ

Bases: pydantic.BaseModel, Generic[StepType]

Generic plan model that can work with any step type.

Supports both linear and tree/split structures.

Parameters:

data (Any)

objectiveΒΆ

What this plan aims to accomplish

stepsΒΆ

List of steps (can be Tasks or nested Plans)

resultΒΆ

The outcome of the plan execution

statusΒΆ

Current status of the 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.

add_parallel_steps(steps)ΒΆ

Add multiple steps that can be executed in parallel (same parent index).

Parameters:

steps (list[Union[StepType, Plan]])

Return type:

list[Union[StepType, Plan]]

add_step(step)ΒΆ

Add a step with auto-indexing.

Parameters:

step (Union[StepType, Plan])

Return type:

Union[StepType, Plan]

create_subplan(objective)ΒΆ

Create a nested subplan for tree structures.

Parameters:

objective (str)

Return type:

Plan

property completed_count: intΒΆ

Number of completed steps.

Return type:

int

property completed_steps: list[StepType | Plan]ΒΆ

List of completed steps.

Return type:

list[Union[StepType, Plan]]

property current_step: StepType | Plan | NoneΒΆ

The current step being executed (first in_progress or pending).

Return type:

Union[StepType, Plan] | None

property failed_steps: list[StepType | Plan]ΒΆ

List of failed steps.

Return type:

list[Union[StepType, Plan]]

property has_failures: boolΒΆ

Whether any steps have failed.

Return type:

bool

property is_complete: boolΒΆ

Whether all steps are completed.

Return type:

bool

property progress_percentage: floatΒΆ

Percentage of completion (0-100).

Return type:

float

property remaining_count: intΒΆ

Number of steps remaining.

Return type:

int

property steps_remaining: list[StepType | Plan]ΒΆ

List of steps that haven’t been completed yet.

Return type:

list[Union[StepType, Plan]]

property total_steps: intΒΆ

Total number of steps (including nested).

Return type:

int

class agents.planning_v2.base.models.StatusΒΆ

Bases: str, enum.Enum

Status for tasks and plans.

Initialize self. See help(type(self)) for accurate signature.

class agents.planning_v2.base.models.Task(/, **data)ΒΆ

Bases: pydantic.BaseModel

Simple task model.

Parameters:

data (Any)

objectiveΒΆ

What this task aims to accomplish

resultΒΆ

The outcome of the task (None if not completed)

statusΒΆ

Current status of the task

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.