Spaces:
Paused
Paused
File size: 991 Bytes
9792ea7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # -*- coding: utf-8 -*-
"""The task class."""
from datetime import datetime
from typing import Any, Literal
from pydantic import BaseModel, Field
from .._utils._common import _generate_id
class Task(BaseModel):
"""The agent task."""
subject: str
"""The subject of the task."""
description: str
"""The task description."""
metadata: dict[str, Any]
"""The additional metadata of the task."""
created_at: str = Field(default_factory=lambda: datetime.now().isoformat())
"""The created timestamp."""
state: Literal["pending", "in_progress", "completed"] = "pending"
"""The task state."""
id: str = Field(default_factory=_generate_id)
"""The task identifier."""
owner: str | None = None
"""The owner of the task."""
blocks: list[str] = Field(default_factory=lambda: [])
"""The task ids blocked by this task."""
blocked_by: list[str] = Field(default_factory=lambda: [])
"""The task ids blocking this task."""
|