Skip to content

Commit 4559b86

Browse files
author
camel-docs-bot
committed
Auto-update documentation after merge [skip ci]
1 parent 6792005 commit 4559b86

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

docs/mintlify/reference/camel.societies.workforce.utils.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,36 @@ def __str__(self):
151151
def __repr__(self):
152152
```
153153

154+
<a id="camel.societies.workforce.utils.FailureHandlingConfig"></a>
155+
156+
## FailureHandlingConfig
157+
158+
```python
159+
class FailureHandlingConfig(BaseModel):
160+
```
161+
162+
Configuration for failure handling behavior in Workforce.
163+
164+
This configuration allows users to customize how the Workforce handles
165+
task failures. This config allows users to disable reassignment or other
166+
recovery strategies as needed.
167+
168+
**Parameters:**
169+
170+
- **max_retries** (int): Maximum number of retry attempts before giving up on a task. (default: :obj:`3`)
171+
- **enabled_strategies** (Optional[List[RecoveryStrategy]]): List of recovery strategies that are allowed to be used. Can be specified as RecoveryStrategy enums or strings (e.g., ["retry", "replan"]). If None, all strategies are enabled (with LLM analysis). If an empty list, no recovery strategies are applied and failed tasks are marked as failed immediately. If only ["retry"] is specified, simple retry is used without LLM analysis. (default: :obj:`None` - all strategies enabled)
172+
- **halt_on_max_retries** (bool): Whether to halt the entire workforce when a task exceeds max retries. If False, the task is marked as failed and the workflow continues (similar to PIPELINE mode behavior). (default: :obj:`True` for AUTO_DECOMPOSE mode behavior)
173+
174+
<a id="camel.societies.workforce.utils.FailureHandlingConfig.validate_enabled_strategies"></a>
175+
176+
### validate_enabled_strategies
177+
178+
```python
179+
def validate_enabled_strategies(cls, v):
180+
```
181+
182+
Convert string list to RecoveryStrategy enum list.
183+
154184
<a id="camel.societies.workforce.utils.FailureContext"></a>
155185

156186
## FailureContext

docs/mintlify/reference/camel.societies.workforce.workforce.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ capabilities
8181
- **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
8282
- **implements**: class:`WorkforceMetrics`, no default logger is added. (default: :obj:`None`)
8383
- **mode** (WorkforceMode, optional): The execution mode for task processing. AUTO_DECOMPOSE mode uses intelligent recovery strategies (decompose, replan, etc.) when tasks fail. PIPELINE mode uses simple retry logic and allows failed tasks to continue the workflow, passing error information to dependent tasks. (default: :obj:`WorkforceMode.AUTO_DECOMPOSE`)
84+
- **failure_handling_config** (Optional[Union[FailureHandlingConfig, Dict]]): Configuration for customizing failure handling behavior. Can be a FailureHandlingConfig instance or a dict with the same fields. Allows fine-grained control over which recovery strategies are enabled, maximum retry attempts, and whether to halt on max retries. The `enabled_strategies` field accepts both enum values and string lists like `["retry", "replan"]`. If None, uses default configuration with all strategies enabled. (default: :obj:`None`)
8485

8586
**Note:**
8687

@@ -108,7 +109,8 @@ def __init__(
108109
use_structured_output_handler: bool = True,
109110
task_timeout_seconds: Optional[float] = None,
110111
mode: WorkforceMode = WorkforceMode.AUTO_DECOMPOSE,
111-
callbacks: Optional[List[WorkforceCallback]] = None
112+
callbacks: Optional[List[WorkforceCallback]] = None,
113+
failure_handling_config: Optional[Union[FailureHandlingConfig, Dict[str, Any]]] = None
112114
):
113115
```
114116

@@ -542,6 +544,29 @@ relationship between the task and its subtasks.
542544
The subtasks or generator of subtasks. Returns empty list for
543545
PIPELINE mode.
544546

547+
<a id="camel.societies.workforce.workforce.Workforce._get_available_strategies_text"></a>
548+
549+
### _get_available_strategies_text
550+
551+
```python
552+
def _get_available_strategies_text(self, for_failure: bool):
553+
```
554+
555+
Generate the available strategies text for the analysis prompt.
556+
557+
This method generates a dynamic list of enabled recovery strategies
558+
based on the failure_handling_config. It only includes strategies
559+
that are both enabled in the config and applicable to the context
560+
(failure vs quality evaluation).
561+
562+
**Parameters:**
563+
564+
- **for_failure** (bool): True for failure analysis, False for quality evaluation. Some strategies are only available in one context.
565+
566+
**Returns:**
567+
568+
str: Formatted text describing available strategies for the prompt.
569+
545570
<a id="camel.societies.workforce.workforce.Workforce._analyze_task"></a>
546571

547572
### _analyze_task

0 commit comments

Comments
 (0)