azad.predefined_tools.task_exit Module¶
azad.predefined_tools.task_exit ¶
Predefined Task Exit Tool Schema and Metadata.
Attributes¶
TASK_EXIT_TOOL_METADATA
module-attribute
¶
TASK_EXIT_TOOL_METADATA = {'name': 'task_exit', 'description': 'Exits the current nested task in the mindmap structure and returns to the parent task', 'parameters': {'handoff_description': {'description': 'Description of the handoff back to the parent task, including results and findings', 'streamable': False}}, 'requires_approval': True, 'required_parameters': ['handoff_description'], 'examples': [{'explanation': 'Exit the current nested task with a summary of findings', 'parameters': {'handoff_description': [{'type': 'text', 'text': 'Analysis complete. I found 3 potential bugs in the code: 1) Null pointer in line 42, 2) Race condition in the async handler, 3) Memory leak in the resource cleanup.'}]}}], 'is_task_entry': False, 'is_task_exit': True, 'task_lifecycle_output_keypairs': {'handoff_description': HANDOFF_DESCRIPTION}}
Classes¶
TaskExitToolSchema ¶
Bases: BaseModel
Input schema for the Task Exit tool.
This defines the required parameters when exiting a nested task.
Attributes¶
handoff_description
class-attribute
instance-attribute
¶
handoff_description: List[Union[TextPart, ImagePart]] = Field(..., description='Description of the handoff back to the parent task, including results and findings')
Functions¶
validate_handoff_description ¶
validate_handoff_description() -> TaskExitToolSchema
Validate that handoff_description contains at least one content part.
Source code in azad/predefined_tools/task_exit.py
from_handoff_description
classmethod
¶
from_handoff_description(handoff_description: List[Union[TextPart, ImagePart]]) -> TaskExitToolSchema
Create a TaskExitToolSchema from a handoff description.
apply_to_task ¶
apply_to_task(task: Task, result_key='task_result') -> Tuple[TaskExitMessage, Optional[ToolMessage]]
Apply this task exit to a Task object.
Returns:
-
Tuple[TaskExitMessage, Optional[ToolMessage]]–A tuple of (TaskExitMessage, ToolMessage) created by exiting the task
Source code in azad/predefined_tools/task_exit.py
TaskExitOutputSchema ¶
Bases: BaseModel
Output schema for the Task Exit tool.
This defines the structure of the result returned when a nested task is exited.
Attributes¶
handoff_description
class-attribute
instance-attribute
¶
handoff_description: List[Union[TextPart, ImagePart]] = Field(..., description='The handoff description that was provided when exiting the task')