motleycrew.tasks.task_unit
Classes
|
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_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'output': FieldInfo(annotation=Union[Any, NoneType], required=False, default=None), 'status': FieldInfo(annotation=str, required=False, default='pending')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.