haive.agents.common.models.task_analysis.base¶

Base classes and enums for task complexity analysis.

This module defines the fundamental building blocks for task complexity analysis including task representations, dependency types, and complexity classifications.

Classes¶

ComplexityLevel

Overall complexity classification for tasks.

ComputationalComplexity

Computational complexity classifications.

DependencyNode

Represents a dependency relationship between tasks or steps.

DependencyType

Types of dependency relationships between tasks.

KnowledgeComplexity

Knowledge complexity requirements.

ResourceType

Types of resources required for task execution.

SolvabilityStatus

Current solvability status of a task.

Task

Represents a complex task that can contain subtasks and steps.

TaskStep

Individual executable step within a task.

TaskType

Types of tasks based on their fundamental nature.

TimeComplexity

Time complexity categories for task completion.

Module Contents¶

class haive.agents.common.models.task_analysis.base.ComplexityLevel¶

Bases: str, enum.Enum

Overall complexity classification for tasks.

TRIVIAL¶

Simple, single-step tasks (1-2 minutes)

SIMPLE¶

Straightforward tasks with few steps (5-15 minutes)

MODERATE¶

Multi-step tasks with some dependencies (30 minutes - 2 hours)

COMPLEX¶

Involved tasks with multiple branches (2-8 hours)

COMPLICATED¶

Sophisticated tasks requiring expertise (1-3 days)

EXPERT¶

High-expertise tasks with uncertainty (weeks)

RESEARCH¶

Unknown solution path, investigation required (months)

UNSOLVABLE¶

Currently impossible or undefined problems

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

class haive.agents.common.models.task_analysis.base.ComputationalComplexity¶

Bases: str, enum.Enum

Computational complexity classifications.

CONSTANT¶

O(1) - Fixed time regardless of input size

LOGARITHMIC¶

O(log n) - Scales logarithmically with input

LINEAR¶

O(n) - Scales linearly with input size

LINEARITHMIC¶

O(n log n) - Common in efficient algorithms

QUADRATIC¶

O(n²) - Scales quadratically

POLYNOMIAL¶

O(n^k) - Polynomial time complexity

EXPONENTIAL¶

O(2^n) - Exponential time complexity

UNKNOWN¶

Complexity cannot be determined

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

class haive.agents.common.models.task_analysis.base.DependencyNode(/, **data)¶

Bases: pydantic.BaseModel

Represents a dependency relationship between tasks or steps.

Parameters:

data (Any)

source_id¶

ID of the source task/step

target_id¶

ID of the target task/step

dependency_type¶

Type of dependency relationship

condition¶

Optional condition for conditional dependencies

weight¶

Strength/importance of the dependency (0.0 to 1.0)

description¶

Human-readable description of the dependency

Example

dependency = DependencyNode(
source_id="lookup_winner",
target_id="lookup_birthday",
dependency_type=DependencyType.SEQUENTIAL,
weight=1.0,
description="Must know winner before looking up their birthday"
)

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.

allows_parallelization()¶

Check if this dependency allows parallel execution.

Returns:

True if source and target can run in parallel

Return type:

bool

creates_join_point()¶

Check if this dependency creates a join point.

Returns:

True if this is a join dependency

Return type:

bool

is_blocking()¶

Check if this dependency creates a blocking relationship.

Returns:

True if the target cannot proceed without the source

Return type:

bool

class haive.agents.common.models.task_analysis.base.DependencyType¶

Bases: str, enum.Enum

Types of dependency relationships between tasks.

SEQUENTIAL¶

Task B cannot start until Task A completes (A → B)

PARALLEL¶

Tasks can execute simultaneously (A || B)

CONDITIONAL¶

Task B only executes if Task A meets conditions (A ?→ B)

ITERATIVE¶

Task B feeds back to Task A (A ↔ B)

JOIN¶

Multiple tasks must complete before next task (A,B → C)

SPLIT¶

One task creates multiple parallel branches (A → B,C)

OPTIONAL¶

Task is optional based on conditions

ALTERNATIVE¶

Either Task A or Task B, but not both (A ⊕ B)

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

class haive.agents.common.models.task_analysis.base.KnowledgeComplexity¶

Bases: str, enum.Enum

Knowledge complexity requirements.

BASIC¶

General knowledge or simple lookup

INTERMEDIATE¶

Domain-specific knowledge required

ADVANCED¶

Deep expertise in specific domain

EXPERT¶

Cutting-edge expertise, research-level knowledge

INTERDISCIPLINARY¶

Knowledge across multiple domains

UNKNOWN¶

Knowledge requirements unclear

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

class haive.agents.common.models.task_analysis.base.ResourceType¶

Bases: str, enum.Enum

Types of resources required for task execution.

HUMAN¶

Human expertise or labor

COMPUTATIONAL¶

Computing resources

DATA¶

Access to specific datasets or information

TOOLS¶

Specialized tools or software

FINANCIAL¶

Monetary resources

TIME¶

Significant time investment

NETWORK¶

Network access or connectivity

STORAGE¶

Data storage capabilities

EXPERTISE¶

Specialized domain expertise

APPROVAL¶

Authorization or approval from authorities

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

class haive.agents.common.models.task_analysis.base.SolvabilityStatus¶

Bases: str, enum.Enum

Current solvability status of a task.

TRIVIAL¶

Task is trivially solvable with basic knowledge/tools

READY¶

Task is immediately solvable with available resources

FEASIBLE¶

Task is solvable with some effort or resource acquisition

CHALLENGING¶

Task is solvable but requires significant effort

THEORETICAL¶

Task is theoretically solvable but practically difficult

RESEARCH¶

Task requires research or unknown solution paths

IMPOSSIBLE¶

Task is currently impossible given constraints

UNDEFINED¶

Solvability cannot be determined

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

class haive.agents.common.models.task_analysis.base.Task(/, **data)¶

Bases: pydantic.BaseModel

Represents a complex task that can contain subtasks and steps.

This is the main building block for task complexity analysis. Tasks can contain either other Tasks or TaskSteps, creating a hierarchical structure that AutoTree can automatically handle.

Parameters:

data (Any)

name¶

Descriptive name for the task

description¶

Detailed description of the task

task_type¶

Primary type of this task

subtasks¶

List of subtasks and steps (Union type for AutoTree)

dependencies¶

Dependency relationships

estimated_duration_minutes¶

Total estimated duration

complexity_level¶

Overall complexity assessment

required_resources¶

Resources needed for the entire task

success_criteria¶

How to measure successful completion

Example

# Create a complex task with mixed subtasks and steps
main_task = Task(
name="Analyze Wimbledon Champion Age",
description="Find recent champion, calculate age, and analyze",
task_type=TaskType.RESEARCH,
subtasks=[
TaskStep(
name="Find winner",
description="Look up most recent Wimbledon champion",
task_type=TaskType.FACTUAL
),
Task(
name="Age Analysis",
description="Calculate and analyze age",
task_type=TaskType.COMPUTATIONAL,
subtasks=[
TaskStep(name="Get birthday", ...),
TaskStep(name="Calculate age", ...),
TaskStep(name="Find square root", ...)
]
)
]
)

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.

calculate_total_duration()¶

Calculate total estimated duration for all subtasks.

Returns:

Total duration in minutes

Return type:

float

create_auto_tree()¶

Create an AutoTree representation of this task.

Returns:

AutoTree instance wrapping this task

Return type:

haive.core.common.structures.tree.AutoTree

get_all_steps()¶

Get all TaskStep objects from the entire task hierarchy.

Returns:

Flattened list of all TaskStep objects

Return type:

list[TaskStep]

get_all_tasks()¶

Get all Task objects from the hierarchy including self.

Returns:

List of all Task objects in the hierarchy

Return type:

list[Task]

get_breadth()¶

Get the breadth (number of direct subtasks) of this task.

Returns:

Number of direct subtasks

Return type:

int

get_max_depth()¶

Calculate the maximum depth of the task hierarchy.

Returns:

Maximum depth (0 for leaf tasks)

Return type:

int

has_parallel_opportunities()¶

Check if this task has opportunities for parallelization.

Returns:

True if some subtasks can potentially run in parallel

Return type:

bool

model_config¶

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class haive.agents.common.models.task_analysis.base.TaskStep(/, **data)¶

Bases: pydantic.BaseModel

Individual executable step within a task.

Represents an atomic unit of work that cannot be further decomposed in the current analysis context.

Parameters:

data (Any)

name¶

Descriptive name for the step

description¶

Detailed description of what the step involves

task_type¶

The type of task this step represents

estimated_duration_minutes¶

Estimated time to complete

required_resources¶

Resources needed for this step

difficulty_level¶

Subjective difficulty assessment

can_be_automated¶

Whether this step can be automated

requires_human_judgment¶

Whether human judgment is essential

dependencies¶

IDs of other steps this depends on

outputs¶

What this step produces

Example

step = TaskStep(
name="Look up Wimbledon winner",
description="Search for the most recent Wimbledon men's singles champion",
task_type=TaskType.FACTUAL,
estimated_duration_minutes=5,
required_resources=[ResourceType.NETWORK, ResourceType.DATA],
can_be_automated=True
)

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.

get_complexity_score()¶

Calculate a complexity score for this step.

Combines duration, difficulty, and resource requirements.

Returns:

Complexity score (0.0 to 10.0)

Return type:

float

get_duration_hours()¶

Get estimated duration in hours.

Returns:

Duration in hours

Return type:

float

is_blocking()¶

Check if this step blocks other steps.

Returns:

True if other steps depend on this one

Return type:

bool

model_config¶

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class haive.agents.common.models.task_analysis.base.TaskType¶

Bases: str, enum.Enum

Types of tasks based on their fundamental nature.

FACTUAL¶

Tasks requiring factual information lookup

COMPUTATIONAL¶

Tasks involving calculations or data processing

RESEARCH¶

Tasks requiring investigation and analysis

CREATIVE¶

Tasks involving creative or generative work

DECISION¶

Tasks requiring decision-making or judgment

COORDINATION¶

Tasks involving coordination between multiple entities

COMMUNICATION¶

Tasks involving information exchange

VERIFICATION¶

Tasks involving validation or checking

SYNTHESIS¶

Tasks combining multiple inputs into new outputs

ITERATIVE¶

Tasks that require multiple cycles or refinement

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

class haive.agents.common.models.task_analysis.base.TimeComplexity¶

Bases: str, enum.Enum

Time complexity categories for task completion.

INSTANT¶

Less than 1 minute

QUICK¶

1-10 minutes

SHORT¶

10-60 minutes

MEDIUM¶

1-8 hours

LONG¶

1-7 days

EXTENDED¶

1-4 weeks

PROJECT¶

1-6 months

RESEARCH¶

6+ months or unknown timeline

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