agents.research.perplexity.pro_search.tasks.modelsΒΆ

Pydantic models for recursive conditional planning with tree-based task decomposition. Supports dynamic planning, parallel execution, and adaptive replanning.

ClassesΒΆ

ExecutionPlan

Execution plan for a set of tasks.

PlanningState

State for recursive planning workflow.

PlanningStrategy

Strategy configuration for the planning process.

ReplanningAnalysis

Analysis for replanning decision.

TaskDecomposition

Result of decomposing a high-level task.

TaskDependency

Dependency relationship between tasks.

TaskMetadata

Metadata for task tracking and optimization.

TaskNode

Individual task node in the planning tree.

TaskPriority

Priority levels for tasks.

TaskResource

Resource requirements for a task.

TaskStatus

Status of a task in the planning tree.

Module ContentsΒΆ

class agents.research.perplexity.pro_search.tasks.models.ExecutionPlan(/, **data)ΒΆ

Bases: pydantic.BaseModel

Execution plan for a set of tasks.

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)

calculate_resource_requirements()ΒΆ

Calculate total resource requirements.

Return type:

ExecutionPlan

property can_parallelize: boolΒΆ

Check if any parallelization is possible.

Return type:

bool

class agents.research.perplexity.pro_search.tasks.models.PlanningState(/, **data)ΒΆ

Bases: pydantic.BaseModel

State for recursive planning workflow.

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_task(task, parent_id=None)ΒΆ

Add a task to the tree.

Parameters:
Return type:

None

update_task_status(task_id, status, result=None)ΒΆ

Update task status and handle state transitions.

Parameters:
Return type:

None

property completion_percentage: floatΒΆ

Calculate completion percentage.

Return type:

float

property critical_path: list[str]ΒΆ

Get current critical path.

Return type:

list[str]

property executable_tasks: list[TaskNode]ΒΆ

Get tasks ready for execution.

Return type:

list[TaskNode]

property is_complete: boolΒΆ

Check if planning goal is achieved.

Return type:

bool

property needs_replanning: boolΒΆ

Check if replanning is needed.

Return type:

bool

class agents.research.perplexity.pro_search.tasks.models.PlanningStrategy(/, **data)ΒΆ

Bases: pydantic.BaseModel

Strategy configuration for the planning process.

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)

validate_strategy_coherence()ΒΆ

Ensure strategy settings are coherent.

Return type:

PlanningStrategy

class agents.research.perplexity.pro_search.tasks.models.ReplanningAnalysis(/, **data)ΒΆ

Bases: pydantic.BaseModel

Analysis for replanning decision.

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.research.perplexity.pro_search.tasks.models.TaskDecomposition(/, **data)ΒΆ

Bases: pydantic.BaseModel

Result of decomposing a high-level 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.

Parameters:

data (Any)

calculate_critical_path()ΒΆ

Calculate critical path if not provided.

Return type:

TaskDecomposition

property parallelizable_groups: list[list[str]]ΒΆ

Identify groups of tasks that can run in parallel.

Return type:

list[list[str]]

class agents.research.perplexity.pro_search.tasks.models.TaskDependency(/, **data)ΒΆ

Bases: pydantic.BaseModel

Dependency relationship between tasks.

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.research.perplexity.pro_search.tasks.models.TaskMetadata(/, **data)ΒΆ

Bases: pydantic.BaseModel

Metadata for task tracking and optimization.

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)

property can_retry: boolΒΆ

Check if task can be retried.

Return type:

bool

property efficiency_ratio: float | NoneΒΆ

Calculate efficiency ratio (estimated vs actual).

Return type:

float | None

class agents.research.perplexity.pro_search.tasks.models.TaskNode(/, **data)ΒΆ

Bases: pydantic.BaseModel

Individual task node in the planning tree.

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)

can_start(completed_tasks)ΒΆ

Check if all dependencies are satisfied.

Parameters:

completed_tasks (set[str])

Return type:

bool

classmethod validate_children_for_type(v, info)ΒΆ

Validate children based on task type.

Return type:

Any

property is_complete: boolΒΆ

Check if task is complete.

Return type:

bool

property is_executable: boolΒΆ

Check if task can be executed.

Return type:

bool

property is_leaf: boolΒΆ

Check if this is a leaf node.

Return type:

bool

class agents.research.perplexity.pro_search.tasks.models.TaskPriorityΒΆ

Bases: str, enum.Enum

Priority levels for tasks.

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

class agents.research.perplexity.pro_search.tasks.models.TaskResource(/, **data)ΒΆ

Bases: pydantic.BaseModel

Resource requirements for a 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.

Parameters:

data (Any)

property resource_key: strΒΆ

Unique key for this resource requirement.

Return type:

str

class agents.research.perplexity.pro_search.tasks.models.TaskStatusΒΆ

Bases: str, enum.Enum

Status of a task in the planning tree.

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