Skip to content

Base action subtask event

BaseActionSubtaskEvent

Bases: BaseTaskEvent, ABC

Source code in griptape/griptape/events/base_action_subtask_event.py
@define
class BaseActionSubtaskEvent(BaseTaskEvent, ABC):
    subtask_parent_task_id: Optional[str] = field(kw_only=True)
    subtask_thought: Optional[str] = field(kw_only=True)
    subtask_action_name: Optional[str] = field(kw_only=True)
    subtask_action_path: Optional[str] = field(kw_only=True)
    subtask_action_input: Optional[dict] = field(kw_only=True)

    @classmethod
    def from_task(cls, task: ActionSubtask) -> BaseActionSubtaskEvent:
        return cls(
            task_id=task.id,
            task_parent_ids=task.parent_ids,
            task_child_ids=task.child_ids,
            task_input=task.input,
            task_output=task.output,
            subtask_parent_task_id=task.parent_task_id,
            subtask_thought=task.thought,
            subtask_action_name=task.action_name,
            subtask_action_path=task.action_path,
            subtask_action_input=task.action_input,
        )

subtask_action_input: Optional[dict] = field(kw_only=True) class-attribute instance-attribute

subtask_action_name: Optional[str] = field(kw_only=True) class-attribute instance-attribute

subtask_action_path: Optional[str] = field(kw_only=True) class-attribute instance-attribute

subtask_parent_task_id: Optional[str] = field(kw_only=True) class-attribute instance-attribute

subtask_thought: Optional[str] = field(kw_only=True) class-attribute instance-attribute

from_task(task) classmethod

Source code in griptape/griptape/events/base_action_subtask_event.py
@classmethod
def from_task(cls, task: ActionSubtask) -> BaseActionSubtaskEvent:
    return cls(
        task_id=task.id,
        task_parent_ids=task.parent_ids,
        task_child_ids=task.child_ids,
        task_input=task.input,
        task_output=task.output,
        subtask_parent_task_id=task.parent_task_id,
        subtask_thought=task.thought,
        subtask_action_name=task.action_name,
        subtask_action_path=task.action_path,
        subtask_action_input=task.action_input,
    )