motleycrew.tasks.task_unit

Classes

TaskUnit(*[, status, output])

Base class for describing task units.

class motleycrew.tasks.task_unit.TaskUnit(*, status: str = 'pending', output: Any | None = None)

Bases: MotleyGraphNode, ABC

Base class for describing task units. A task unit should contain all the input data for the worker (usually an agent). When a task unit is dispatched by the crew, it is converted to a dictionary and passed to the worker’s invoke() method.

status

Status of the task unit.

Type:

str

output

Output of the task unit.

Type:

Optional[Any]

status: str
output: Any | None
property pending

Whether the task unit is pending.

property running

Whether the task unit is running.

property done

Whether the task unit is done.

set_pending()

Set the task unit status to pending.

set_running()

Set the task unit status to running.

set_done()

Set the task unit status to done.

as_dict()

Represent the task as a dictionary for passing to invoke() methods of runnables.

model_config: ClassVar[ConfigDict] = {}

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