Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ body:
attributes:
label: What version of camel are you using?
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
placeholder: E.g., 0.2.83a7
placeholder: E.g., 0.2.83a8
validations:
required: true

Expand Down
2 changes: 1 addition & 1 deletion camel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from camel.logger import disable_logging, enable_logging, set_log_level

__version__ = '0.2.83a7'
__version__ = '0.2.83a8'

__all__ = [
'__version__',
Expand Down
17 changes: 10 additions & 7 deletions camel/societies/workforce/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,15 @@

**DECISION GUIDELINES:**

**Priority Rules:**
1. Connection/Network Errors → **retry** (almost always)
2. Deep Tasks (depth > 2) → Avoid decompose, prefer **retry** or **replan**
3. Worker Skill Mismatch → **reassign** (quality) or **decompose** (failure)
4. Unclear Requirements → **replan** with specifics
5. Task Too Complex → **decompose** into subtasks
**IMPORTANT: You MUST ONLY select from the ENABLED strategies listed above.**
If a strategy is not in the ENABLED list, you CANNOT use it regardless of the guidelines below.

**Priority Rules (apply ONLY if the strategy is ENABLED):**
1. Connection/Network Errors → prefer **retry** if enabled
2. Deep Tasks (depth > 2) → Avoid decompose, prefer **retry** or **replan** if enabled
3. Worker Skill Mismatch → prefer **reassign** (quality) or **decompose** (failure) if enabled, otherwise use **replan**
4. Unclear Requirements → prefer **replan** with specifics if enabled
5. Task Too Complex → prefer **decompose** into subtasks if enabled, otherwise use **replan**

**RESPONSE FORMAT:**
{response_format}
Expand All @@ -355,7 +358,7 @@
- No explanations or text outside the JSON structure
- Ensure all required fields are included
- Use null for optional fields when not applicable
- ONLY use strategies listed above as ENABLED
- **MANDATORY: The recovery_strategy MUST be one of the ENABLED strategies listed above. Using a disabled strategy will cause an error.**
"""
)

Expand Down
48 changes: 42 additions & 6 deletions camel/societies/workforce/workforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -4542,15 +4542,29 @@ async def _handle_failed_task(self, task: Task) -> bool:
task, for_failure=True, error_message=detailed_error
)

# Fallback to first enabled strategy if no strategy recommended
# Validate and fallback recovery strategy based on enabled_strategies
config_strategies = self.failure_handling_config.enabled_strategies
if recovery_decision.recovery_strategy is None:
config_strategies = self.failure_handling_config.enabled_strategies
# No strategy recommended - use fallback
# config_strategies is None means all enabled, use RETRY as default
# otherwise use the first enabled strategy from user's config
if config_strategies is None:
recovery_decision.recovery_strategy = RecoveryStrategy.RETRY
else:
recovery_decision.recovery_strategy = config_strategies[0]
elif config_strategies is not None:
# Strategy recommended - validate it's in enabled list
if recovery_decision.recovery_strategy not in config_strategies:
# LLM recommended a disabled strategy, use first enabled
recommended = recovery_decision.recovery_strategy.value
enabled_list = [s.value for s in config_strategies]
fallback = config_strategies[0].value
logger.warning(
f"Task {task.id}: LLM recommended '{recommended}' "
f"but it's not in enabled_strategies {enabled_list}. "
f"Using '{fallback}' instead."
)
recovery_decision.recovery_strategy = config_strategies[0]

strategy_str = recovery_decision.recovery_strategy.value
logger.info(
Expand Down Expand Up @@ -5308,11 +5322,12 @@ async def _listen_to_channel(self) -> None:
f"Issues: {', '.join(quality_eval.issues)}"
)

# Fallback to first enabled strategy if none
# recommended
# Validate and fallback recovery strategy based on
# enabled_strategies
config = self.failure_handling_config
config_strategies = config.enabled_strategies
if quality_eval.recovery_strategy is None:
config = self.failure_handling_config
config_strategies = config.enabled_strategies
# No strategy recommended - use fallback
if config_strategies is None:
quality_eval.recovery_strategy = (
RecoveryStrategy.RETRY
Expand All @@ -5321,6 +5336,27 @@ async def _listen_to_channel(self) -> None:
quality_eval.recovery_strategy = (
config_strategies[0]
)
elif config_strategies is not None:
# Strategy recommended - validate it's enabled
if (
quality_eval.recovery_strategy
not in config_strategies
):
# LLM recommended a disabled strategy
rec = quality_eval.recovery_strategy.value
enabled = [
s.value for s in config_strategies
]
fallback = config_strategies[0].value
logger.warning(
f"Task {returned_task.id}: LLM "
f"recommended '{rec}' but it's not in "
f"enabled_strategies {enabled}. "
f"Using '{fallback}' instead."
)
quality_eval.recovery_strategy = (
config_strategies[0]
)

# Preserve assignee before cleanup - in normal
# flow, a task must be assigned before it can fail
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
project = 'CAMEL'
copyright = '2024, CAMEL-AI.org'
author = 'CAMEL-AI.org'
release = '0.2.83a7'
release = '0.2.83a8'

html_favicon = (
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "camel-ai"
version = "0.2.83a7"
version = "0.2.83a8"
description = "Communicative Agents for AI Society Study"
authors = [{ name = "CAMEL-AI.org" }]
requires-python = ">=3.10,<3.15"
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading