> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.societies.workforce.task channel

<a id="camel.societies.workforce.task_channel" />

<a id="camel.societies.workforce.task_channel.PacketStatus" />

## PacketStatus

```python theme={"system"}
class PacketStatus(Enum):
```

The status of a packet. The packet can be in one of the following
states:

* `__INLINE_CODE_0__`: The packet has been sent to a worker.
* `__INLINE_CODE_1__`: The packet has been claimed by a worker and is being
  processed.
* `__INLINE_CODE_2__`: The packet has been returned by the worker, meaning that
  the status of the task inside has been updated.
* `__INLINE_CODE_3__`: The packet has been archived, meaning that the content of
  the task inside will not be changed. The task is considered
  as a dependency.

<a id="camel.societies.workforce.task_channel.Packet" />

## Packet

```python theme={"system"}
class Packet:
```

The basic element inside the channel. A task is wrapped inside a
packet. The packet will contain the task, along with the task's assignee,
and the task's status.

**Parameters:**

* **task** (Task): The task that is wrapped inside the packet.
* **publisher\_id** (str): The ID of the workforce that published the task.
* **assignee\_id** (Optional\[str], optional): The ID of the workforce that is assigned to the task. Would be None if the task is a dependency. Defaults to None.
* **status** (PacketStatus): The status of the task.

<a id="camel.societies.workforce.task_channel.Packet.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    task: Task,
    publisher_id: str,
    assignee_id: Optional[str] = None,
    status: PacketStatus = PacketStatus.SENT
):
```

<a id="camel.societies.workforce.task_channel.Packet.__repr__" />

### **repr**

```python theme={"system"}
def __repr__(self):
```

<a id="camel.societies.workforce.task_channel.TaskChannel" />

## TaskChannel

```python theme={"system"}
class TaskChannel:
```

An internal class used by Workforce to manage tasks.

This implementation uses a hybrid data structure approach:

* Hash map (\_task\_dict) for O(1) task lookup by ID
* Status-based index (\_task\_by\_status) for efficient filtering by status
* Assignee/publisher queues for ordered task processing

<a id="camel.societies.workforce.task_channel.TaskChannel.__init__" />

### **init**

```python theme={"system"}
def __init__(self):
```

<a id="camel.societies.workforce.task_channel.TaskChannel._update_task_status" />

### \_update\_task\_status

```python theme={"system"}
def _update_task_status(self, task_id: str, new_status: PacketStatus):
```

Helper method to properly update task status in all indexes.

<a id="camel.societies.workforce.task_channel.TaskChannel._cleanup_task_from_indexes" />

### \_cleanup\_task\_from\_indexes

```python theme={"system"}
def _cleanup_task_from_indexes(self, task_id: str):
```

Helper method to remove a task from all indexes.

**Parameters:**

* **task\_id** (str): The ID of the task to remove from indexes.
