🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
Auto-update documentation after merge [skip ci]
camel-docs-botde2f0b8bfc63
diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.jsonindex bf5641b46..6f59fed31 100644--- a/docs/mintlify/docs.json+++ b/docs/mintlify/docs.json@@ -432,7 +432,9 @@"reference/camel.societies.workforce.utils","reference/camel.societies.workforce.worker","reference/camel.societies.workforce.workforce",- "reference/camel.societies.workforce.workforce_logger"+ "reference/camel.societies.workforce.workforce_callback",+ "reference/camel.societies.workforce.workforce_logger",+ "reference/camel.societies.workforce.workforce_metrics"]},{diff --git a/docs/mintlify/key_modules/workforce.mdx b/docs/mintlify/key_modules/workforce.mdxindex d2192203a..2e33e5a04 100644--- a/docs/mintlify/key_modules/workforce.mdx+++ b/docs/mintlify/key_modules/workforce.mdx@@ -22,8 +22,10 @@ class Workforce(BaseNode):task_agent: Optional[ChatAgent] = None,new_worker_agent: Optional[ChatAgent] = None,graceful_shutdown_timeout: float = 15.0,+ task_timeout_seconds: Optional[float] = None,share_memory: bool = False,use_structured_output_handler: bool = True,+ callbacks: Optional[List[WorkforceCallback]] = None,) -> None:# ...```@@ -35,8 +37,10 @@ class Workforce(BaseNode):- `coordinator_agent`: A `ChatAgent` for assigning tasks.- `task_agent`: A `ChatAgent` for decomposing tasks.- `new_worker_agent`: A template `ChatAgent` for creating new workers.+- `task_timeout_seconds`: Optional per-workforce task timeout in seconds.- `share_memory`: If `True`, `SingleAgentWorker` instances will share memory.- `use_structured_output_handler`: Defaults to `True`. Enables structured output handling so models without native JSON + tool-calling can still interop reliably.+- `callbacks`: Optional A list of callback handlers to observe and record workforce lifecycle events and metrics.</Card><Card title="Worker Types" icon="users-gear">@@ -247,4 +251,4 @@ Understanding these models is key to interpreting the workforce's internal state>Full documentation for advanced usage and configuration.</Card>-</CardGroup>\ No newline at end of file+</CardGroup>diff --git a/docs/mintlify/reference/camel.societies.workforce.workforce.mdx b/docs/mintlify/reference/camel.societies.workforce.workforce.mdxindex 08f71fdf4..a70dcbe05 100644--- a/docs/mintlify/reference/camel.societies.workforce.workforce.mdx+++ b/docs/mintlify/reference/camel.societies.workforce.workforce.mdx@@ -67,6 +67,9 @@ capabilities- **task_timeout_seconds** (Optional[float], optional): The timeout in seconds for waiting for tasks to be returned by workers. If None, uses the global TASK_TIMEOUT_SECONDS value (600.0 seconds). Increase this value for tasks that require more processing time. (default: :obj:`None`)- **share_memory** (bool, optional): Whether to enable shared memory across SingleAgentWorker instances in the workforce. When enabled, all SingleAgentWorker instances, coordinator agent, and task planning agent will share their complete conversation history and function-calling trajectory, providing better context for task handoffs and continuity. Note: Currently only supports SingleAgentWorker instances; RolePlayingWorker and nested Workforce instances do not participate in memory sharing. (default: :obj:`False`)- **use_structured_output_handler** (bool, optional): Whether to use the structured output handler instead of native structured output. When enabled, the workforce will use prompts with structured output instructions and regex extraction to parse responses. This ensures compatibility with agents that don't reliably support native structured output. When disabled, the workforce uses the native response_format parameter. (default: :obj:`True`)+- **callbacks** (Optional[List[WorkforceCallback]], optional): A list of callback handlers to observe and record workforce lifecycle events and metrics (e.g., task creation/assignment/start/completion/ failure, worker creation/deletion, all-tasks-completed). All items must be instances of :class:`WorkforceCallback`, otherwise+- **a**: class:`ValueError` is raised. If none of the provided callbacks implement :class:`WorkforceMetrics`, a built-in :class:`WorkforceLogger` (implements both callback and metrics) is added automatically. If at least one provided callback+- **implements**: class:`WorkforceMetrics`, no default logger is added. (default: :obj:`None`)**Note:**@@ -92,10 +95,31 @@ def __init__(graceful_shutdown_timeout: float = 15.0,share_memory: bool = False,use_structured_output_handler: bool = True,- task_timeout_seconds: Optional[float] = None+ task_timeout_seconds: Optional[float] = None,+ callbacks: Optional[List[WorkforceCallback]] = None):```+<a id="camel.societies.workforce.workforce.Workforce._initialize_callbacks"></a>++### _initialize_callbacks++```python+def _initialize_callbacks(self, callbacks: Optional[List[WorkforceCallback]]):+```++Validate, register, and prime workforce callbacks.++<a id="camel.societies.workforce.workforce.Workforce._notify_worker_created"></a>++### _notify_worker_created++```python+def _notify_worker_created(self, worker_node: BaseNode):+```++Emit a worker-created event to all registered callbacks.+<a id="camel.societies.workforce.workforce.Workforce._get_or_create_shared_context_utility"></a>### _get_or_create_shared_context_utilitydiff --git a/docs/mintlify/reference/camel.societies.workforce.workforce_callback.mdx b/docs/mintlify/reference/camel.societies.workforce.workforce_callback.mdxnew file mode 100644index 000000000..309399606--- /dev/null+++ b/docs/mintlify/reference/camel.societies.workforce.workforce_callback.mdx@@ -0,0 +1,85 @@+<a id="camel.societies.workforce.workforce_callback"></a>++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback"></a>++## WorkforceCallback++```python+class WorkforceCallback(ABC):+```++Interface for recording workforce lifecycle events.++Implementations should persist or stream events as appropriate.++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_task_created"></a>++### log_task_created++```python+def log_task_created(self, event: TaskCreatedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_task_decomposed"></a>++### log_task_decomposed++```python+def log_task_decomposed(self, event: TaskDecomposedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_task_assigned"></a>++### log_task_assigned++```python+def log_task_assigned(self, event: TaskAssignedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_task_started"></a>++### log_task_started++```python+def log_task_started(self, event: TaskStartedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_task_completed"></a>++### log_task_completed++```python+def log_task_completed(self, event: TaskCompletedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_task_failed"></a>++### log_task_failed++```python+def log_task_failed(self, event: TaskFailedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_worker_created"></a>++### log_worker_created++```python+def log_worker_created(self, event: WorkerCreatedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_worker_deleted"></a>++### log_worker_deleted++```python+def log_worker_deleted(self, event: WorkerDeletedEvent):+```++<a id="camel.societies.workforce.workforce_callback.WorkforceCallback.log_all_tasks_completed"></a>++### log_all_tasks_completed++```python+def log_all_tasks_completed(self, event: AllTasksCompletedEvent):+```diff --git a/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx b/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdxindex 127b70955..952cc8796 100644--- a/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx+++ b/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx@@ -5,7 +5,7 @@## WorkforceLogger```python-class WorkforceLogger:+class WorkforceLogger(WorkforceCallback, WorkforceMetrics):```Logs events and metrics for a Workforce instance.@@ -43,14 +43,7 @@ Internal method to create and store a log entry.### log_task_created```python-def log_task_created(- self,- task_id: str,- description: str,- parent_task_id: Optional[str] = None,- task_type: Optional[str] = None,- metadata: Optional[Dict[str, Any]] = None-):+def log_task_created(self, event: TaskCreatedEvent):```Logs the creation of a new task.@@ -60,12 +53,7 @@ Logs the creation of a new task.### log_task_decomposed```python-def log_task_decomposed(- self,- parent_task_id: str,- subtask_ids: List[str],- metadata: Optional[Dict[str, Any]] = None-):+def log_task_decomposed(self, event: TaskDecomposedEvent):```Logs the decomposition of a task into subtasks.@@ -75,14 +63,7 @@ Logs the decomposition of a task into subtasks.### log_task_assigned```python-def log_task_assigned(- self,- task_id: str,- worker_id: str,- queue_time_seconds: Optional[float] = None,- dependencies: Optional[List[str]] = None,- metadata: Optional[Dict[str, Any]] = None-):+def log_task_assigned(self, event: TaskAssignedEvent):```Logs the assignment of a task to a worker.@@ -92,12 +73,7 @@ Logs the assignment of a task to a worker.### log_task_started```python-def log_task_started(- self,- task_id: str,- worker_id: str,- metadata: Optional[Dict[str, Any]] = None-):+def log_task_started(self, event: TaskStartedEvent):```Logs when a worker starts processing a task.@@ -107,15 +83,7 @@ Logs when a worker starts processing a task.### log_task_completed```python-def log_task_completed(- self,- task_id: str,- worker_id: str,- result_summary: Optional[str] = None,- processing_time_seconds: Optional[float] = None,- token_usage: Optional[Dict[str, int]] = None,- metadata: Optional[Dict[str, Any]] = None-):+def log_task_completed(self, event: TaskCompletedEvent):```Logs the successful completion of a task.@@ -125,13 +93,7 @@ Logs the successful completion of a task.### log_task_failed```python-def log_task_failed(- self,- task_id: str,- error_message: str,- worker_id: Optional[str] = None,- metadata: Optional[Dict[str, Any]] = None-):+def log_task_failed(self, event: TaskFailedEvent):```Logs the failure of a task.@@ -141,13 +103,7 @@ Logs the failure of a task.### log_worker_created```python-def log_worker_created(- self,- worker_id: str,- worker_type: str,- role: str,- metadata: Optional[Dict[str, Any]] = None-):+def log_worker_created(self, event: WorkerCreatedEvent):```Logs the creation of a new worker.@@ -157,42 +113,39 @@ Logs the creation of a new worker.### log_worker_deleted```python-def log_worker_deleted(- self,- worker_id: str,- reason: Optional[str] = None,- metadata: Optional[Dict[str, Any]] = None-):+def log_worker_deleted(self, event: WorkerDeletedEvent):```Logs the deletion of a worker.-<a id="camel.societies.workforce.workforce_logger.WorkforceLogger.reset_task_data"></a>+<a id="camel.societies.workforce.workforce_logger.WorkforceLogger.log_queue_status"></a>-### reset_task_data+### log_queue_status```python-def reset_task_data(self):+def log_queue_status(self, event: QueueStatusEvent):```-Resets logs and data related to tasks, preserving worker-information.+Logs the status of a task queue.-<a id="camel.societies.workforce.workforce_logger.WorkforceLogger.log_queue_status"></a>+<a id="camel.societies.workforce.workforce_logger.WorkforceLogger.log_all_tasks_completed"></a>-### log_queue_status+### log_all_tasks_completed```python-def log_queue_status(- self,- queue_name: str,- length: int,- pending_task_ids: Optional[List[str]] = None,- metadata: Optional[Dict[str, Any]] = None-):+def log_all_tasks_completed(self, event: AllTasksCompletedEvent):```-Logs the status of a task queue.+<a id="camel.societies.workforce.workforce_logger.WorkforceLogger.reset_task_data"></a>++### reset_task_data++```python+def reset_task_data(self):+```++Resets logs and data related to tasks, preserving worker+information.<a id="camel.societies.workforce.workforce_logger.WorkforceLogger.dump_to_json"></a>diff --git a/docs/mintlify/reference/camel.societies.workforce.workforce_metrics.mdx b/docs/mintlify/reference/camel.societies.workforce.workforce_metrics.mdxnew file mode 100644index 000000000..f39a0a562--- /dev/null+++ b/docs/mintlify/reference/camel.societies.workforce.workforce_metrics.mdx@@ -0,0 +1,41 @@+<a id="camel.societies.workforce.workforce_metrics"></a>++<a id="camel.societies.workforce.workforce_metrics.WorkforceMetrics"></a>++## WorkforceMetrics++```python+class WorkforceMetrics(ABC):+```++<a id="camel.societies.workforce.workforce_metrics.WorkforceMetrics.reset_task_data"></a>++### reset_task_data++```python+def reset_task_data(self):+```++<a id="camel.societies.workforce.workforce_metrics.WorkforceMetrics.dump_to_json"></a>++### dump_to_json++```python+def dump_to_json(self, file_path: str):+```++<a id="camel.societies.workforce.workforce_metrics.WorkforceMetrics.get_ascii_tree_representation"></a>++### get_ascii_tree_representation++```python+def get_ascii_tree_representation(self):+```++<a id="camel.societies.workforce.workforce_metrics.WorkforceMetrics.get_kpis"></a>++### get_kpis++```python+def get_kpis(self):+```