Skip to content

Base task event

BaseTaskEvent

Bases: BaseEvent, ABC

Source code in griptape/griptape/events/base_task_event.py
@define
class BaseTaskEvent(BaseEvent, ABC):
    task_id: str = field(kw_only=True)
    task_parent_ids: list[str] = field(kw_only=True)
    task_child_ids: list[str] = field(kw_only=True)

    task_input: BaseArtifact = field(kw_only=True)
    task_output: BaseArtifact | None = field(kw_only=True)

    @classmethod
    def from_task(cls, task: BaseTask) -> BaseTaskEvent:
        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,
        )

task_child_ids: list[str] = field(kw_only=True) class-attribute instance-attribute

task_id: str = field(kw_only=True) class-attribute instance-attribute

task_input: BaseArtifact = field(kw_only=True) class-attribute instance-attribute

task_output: BaseArtifact | None = field(kw_only=True) class-attribute instance-attribute

task_parent_ids: list[str] = field(kw_only=True) class-attribute instance-attribute

from_task(task) classmethod

Source code in griptape/griptape/events/base_task_event.py
@classmethod
def from_task(cls, task: BaseTask) -> BaseTaskEvent:
    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,
    )