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ΒΆ
Overall complexity classification for tasks. |
|
Computational complexity classifications. |
|
Represents a dependency relationship between tasks or steps. |
|
Types of dependency relationships between tasks. |
|
Knowledge complexity requirements. |
|
Types of resources required for task execution. |
|
Current solvability status of a task. |
|
Represents a complex task that can contain subtasks and steps. |
|
Individual executable step within a task. |
|
Types of tasks based on their fundamental nature. |
|
Time complexity categories for task completion. |
Module ContentsΒΆ
- class agents.common.models.task_analysis.base.ComplexityLevelΒΆ
-
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 agents.common.models.task_analysis.base.ComputationalComplexityΒΆ
-
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 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:
- creates_join_point()ΒΆ
Check if this dependency creates a join point.
- Returns:
True if this is a join dependency
- Return type:
- class agents.common.models.task_analysis.base.DependencyTypeΒΆ
-
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 agents.common.models.task_analysis.base.KnowledgeComplexityΒΆ
-
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 agents.common.models.task_analysis.base.ResourceTypeΒΆ
-
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 agents.common.models.task_analysis.base.SolvabilityStatusΒΆ
-
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 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:
- 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.
- get_all_tasks()ΒΆ
Get all Task objects from the hierarchy including self.
- get_breadth()ΒΆ
Get the breadth (number of direct subtasks) of this task.
- Returns:
Number of direct subtasks
- Return type:
- get_max_depth()ΒΆ
Calculate the maximum depth of the task hierarchy.
- Returns:
Maximum depth (0 for leaf tasks)
- Return type:
- has_parallel_opportunities()ΒΆ
Check if this task has opportunities for parallelization.
- Returns:
True if some subtasks can potentially run in parallel
- Return type:
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class 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:
- get_duration_hours()ΒΆ
Get estimated duration in hours.
- Returns:
Duration in hours
- Return type:
- is_blocking()ΒΆ
Check if this step blocks other steps.
- Returns:
True if other steps depend on this one
- Return type:
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agents.common.models.task_analysis.base.TaskTypeΒΆ
-
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 agents.common.models.task_analysis.base.TimeComplexityΒΆ
-
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.