Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Auto-update documentation after merge

camel-docs-bot6bed4f98a25e
diff --git a/docs/mintlify/reference/camel.societies.workforce.utils.mdx b/docs/mintlify/reference/camel.societies.workforce.utils.mdx
index d44c9ad17..7f531ef30 100644
--- a/docs/mintlify/reference/camel.societies.workforce.utils.mdx
+++ b/docs/mintlify/reference/camel.societies.workforce.utils.mdx
@@ -58,6 +58,52 @@ class TaskAssignResult(BaseModel):
The result of task assignment for both single and batch assignments.
+<a id="camel.societies.workforce.utils.RecoveryStrategy"></a>
+
+## RecoveryStrategy
+
+```python
+class RecoveryStrategy(str, Enum):
+```
+
+Strategies for handling failed tasks.
+
+<a id="camel.societies.workforce.utils.RecoveryStrategy.__str__"></a>
+
+### __str__
+
+```python
+def __str__(self):
+```
+
+<a id="camel.societies.workforce.utils.RecoveryStrategy.__repr__"></a>
+
+### __repr__
+
+```python
+def __repr__(self):
+```
+
+<a id="camel.societies.workforce.utils.FailureContext"></a>
+
+## FailureContext
+
+```python
+class FailureContext(BaseModel):
+```
+
+Context information about a task failure.
+
+<a id="camel.societies.workforce.utils.RecoveryDecision"></a>
+
+## RecoveryDecision
+
+```python
+class RecoveryDecision(BaseModel):
+```
+
+Decision on how to recover from a task failure.
+
<a id="camel.societies.workforce.utils.check_if_running"></a>
## check_if_running
diff --git a/docs/mintlify/reference/camel.societies.workforce.workforce.mdx b/docs/mintlify/reference/camel.societies.workforce.workforce.mdx
index be56de108..e665d7410 100644
--- a/docs/mintlify/reference/camel.societies.workforce.workforce.mdx
+++ b/docs/mintlify/reference/camel.societies.workforce.workforce.mdx
@@ -175,6 +175,26 @@ Update dependency tracking when a task is decomposed into subtasks.
Tasks that depended on the original task should now depend on all
subtasks. The last subtask inherits the original task's dependencies.
+<a id="camel.societies.workforce.workforce.Workforce._increment_in_flight_tasks"></a>
+
+### _increment_in_flight_tasks
+
+```python
+def _increment_in_flight_tasks(self, task_id: str):
+```
+
+Safely increment the in-flight tasks counter with logging.
+
+<a id="camel.societies.workforce.workforce.Workforce._decrement_in_flight_tasks"></a>
+
+### _decrement_in_flight_tasks
+
+```python
+def _decrement_in_flight_tasks(self, task_id: str, context: str = ''):
+```
+
+Safely decrement the in-flight tasks counter with safety checks.
+
<a id="camel.societies.workforce.workforce.Workforce._cleanup_task_tracking"></a>
### _cleanup_task_tracking
@@ -201,6 +221,25 @@ def _decompose_task(self, task: Task):
List[Task]: The subtasks.
+<a id="camel.societies.workforce.workforce.Workforce._analyze_failure"></a>
+
+### _analyze_failure
+
+```python
+def _analyze_failure(self, task: Task, error_message: str):
+```
+
+Analyze a task failure and decide on the best recovery strategy.
+
+**Parameters:**
+
+- **task** (Task): The failed task
+- **error_message** (str): The error message from the failure
+
+**Returns:**
+
+ RecoveryDecision: The decided recovery strategy with reasoning
+
<a id="camel.societies.workforce.workforce.Workforce.pause"></a>
### pause
@@ -408,6 +447,20 @@ def continue_from_pause(self):
Optional[Task]: The completed task if execution finishes, None if
still running/paused.
+<a id="camel.societies.workforce.workforce.Workforce._start_child_node_when_paused"></a>
+
+### _start_child_node_when_paused
+
+```python
+def _start_child_node_when_paused(self, start_coroutine: Coroutine):
+```
+
+Helper to start a child node when workforce is paused.
+
+**Parameters:**
+
+- **start_coroutine**: The coroutine to start (e.g., worker_node.start())
+
<a id="camel.societies.workforce.workforce.Workforce.add_single_agent_worker"></a>
### add_single_agent_worker
@@ -422,6 +475,7 @@ def add_single_agent_worker(
```
Add a worker node to the workforce that uses a single agent.
+Can be called when workforce is paused to dynamically add workers.
**Parameters:**
@@ -451,6 +505,7 @@ def add_role_playing_worker(
```
Add a worker node to the workforce that uses `RolePlaying` system.
+Can be called when workforce is paused to dynamically add workers.
**Parameters:**
@@ -475,6 +530,7 @@ def add_workforce(self, workforce: Workforce):
```
Add a workforce node to the workforce.
+Can be called when workforce is paused to dynamically add workers.
**Parameters:**
diff --git a/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx b/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx
index d5ab34e3a..127b70955 100644
--- a/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx
+++ b/docs/mintlify/reference/camel.societies.workforce.workforce_logger.mdx
@@ -129,7 +129,6 @@ def log_task_failed(
self,
task_id: str,
error_message: str,
- error_type: str,
worker_id: Optional[str] = None,
metadata: Optional[Dict[str, Any]] = None
):
diff --git a/docs/mintlify/reference/camel.toolkits.file_write_toolkit.mdx b/docs/mintlify/reference/camel.toolkits.file_write_toolkit.mdx
index 69090340a..b1abdb08a 100644
--- a/docs/mintlify/reference/camel.toolkits.file_write_toolkit.mdx
+++ b/docs/mintlify/reference/camel.toolkits.file_write_toolkit.mdx
@@ -12,8 +12,9 @@ A toolkit for creating, writing, and modifying text in files.
This class provides cross-platform (macOS, Linux, Windows) support for
writing to various file formats (Markdown, DOCX, PDF, and plaintext),
-replacing text in existing files, automatic backups, custom encoding,
-and enhanced formatting options for specialized formats.
+replacing text in existing files, automatic filename uniquification to
+prevent overwrites, custom encoding and enhanced formatting options for
+specialized formats.
<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit.__init__"></a>
@@ -82,19 +83,23 @@ Write text content to a plaintext file.
- **content** (str): The text content to write.
- **encoding** (str): Character encoding to use. (default: :obj:`utf-8`) (default: utf-8)
-<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._create_backup"></a>
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._generate_unique_filename"></a>
-### _create_backup
+### _generate_unique_filename
```python
-def _create_backup(self, file_path: Path):
+def _generate_unique_filename(self, file_path: Path):
```
-Create a backup of the file if it exists and backup is enabled.
+Generate a unique filename if the target file already exists.
**Parameters:**
-- **file_path** (Path): Path to the file to backup.
+- **file_path** (Path): The original file path.
+
+**Returns:**
+
+ Path: A unique file path that doesn't exist yet.
<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._write_docx_file"></a>
@@ -120,19 +125,183 @@ def _write_pdf_file(
self,
file_path: Path,
title: str,
- content: str,
+ content: Union[str, List[List[str]]],
use_latex: bool = False
):
```
-Write text content to a PDF file with default formatting.
+Write text content to a PDF file with LaTeX and table support.
**Parameters:**
- **file_path** (Path): The target file path.
-- **title** (str): The title of the document.
-- **content** (str): The text content to write.
-- **use_latex** (bool): Whether to use LaTeX for rendering. Only Recommended for documents with mathematical formulas or complex typesetting needs. (default: :obj:`False`)
+- **title** (str): The document title.
+- **content** (Union[str, List[List[str]]]): The content to write. Can
+- **be**: - String: Supports Markdown-style tables and LaTeX math expressions - List[List[str]]: Table data as list of rows for direct table rendering
+- **use_latex** (bool): Whether to use LaTeX for math rendering. (default: :obj:`False`)
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._process_text_content"></a>
+
+### _process_text_content
+
+```python
+def _process_text_content(
+ self,
+ story,
+ content: str,
+ heading_style,
+ body_style
+):
+```
+
+Process text content and add to story.
+
+**Parameters:**
+
+- **story**: The reportlab story list to append to
+- **content** (str): The text content to process
+- **heading_style**: Style for headings
+- **body_style**: Style for body text
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._find_table_line_ranges"></a>
+
+### _find_table_line_ranges
+
+```python
+def _find_table_line_ranges(self, lines: List[str]):
+```
+
+Find line ranges that contain markdown tables.
+
+**Parameters:**
+
+- **lines** (List[str]): List of lines to analyze.
+
+**Returns:**
+
+ List[Tuple[int, int]]: List of (start_line, end_line) tuples
+for table ranges.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._register_chinese_font"></a>
+
+### _register_chinese_font
+
+```python
+def _register_chinese_font(self):
+```
+
+**Returns:**
+
+ str: The font name to use for Chinese text.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._parse_markdown_table"></a>
+
+### _parse_markdown_table
+
+```python
+def _parse_markdown_table(self, lines: List[str]):
+```
+
+Parse markdown-style tables from a list of lines.
+
+**Parameters:**
+
+- **lines** (List[str]): List of text lines that may contain tables.
+
+**Returns:**
+
+ List[List[List[str]]]: List of tables, where each table is a list
+of rows, and each row is a list of cells.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._is_table_row"></a>
+
+### _is_table_row
+
+```python
+def _is_table_row(self, line: str):
+```
+
+Check if a line appears to be a table row.
+
+**Parameters:**
+
+- **line** (str): The line to check.
+
+**Returns:**
+
+ bool: True if the line looks like a table row.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._is_table_separator"></a>
+
+### _is_table_separator
+
+```python
+def _is_table_separator(self, line: str):
+```
+
+Check if a line is a table separator (e.g., |---|---|).
+
+**Parameters:**
+
+- **line** (str): The line to check.
+
+**Returns:**
+
+ bool: True if the line is a table separator.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._parse_table_row"></a>
+
+### _parse_table_row
+
+```python
+def _parse_table_row(self, line: str):
+```
+
+Parse a single table row into cells.
+
+**Parameters:**
+
+- **line** (str): The table row line.
+
+**Returns:**
+
+ List[str]: List of cell contents.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._create_pdf_table"></a>
+
+### _create_pdf_table
+
+```python
+def _create_pdf_table(self, table_data: List[List[str]]):
+```
+
+Create a formatted table for PDF.
+
+**Parameters:**
+
+- **table_data** (List[List[str]]): Table data as list of rows.
+
+**Returns:**
+
+ Table: A formatted reportlab Table object.
+
+<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._convert_markdown_to_html"></a>
+
+### _convert_markdown_to_html
+
+```python
+def _convert_markdown_to_html(self, text: str):
+```
+
+Convert basic markdown formatting to HTML for PDF rendering.
+
+**Parameters:**
+
+- **text** (str): Text with markdown formatting.
+
+**Returns:**
+
+ str: Text with HTML formatting.
<a id="camel.toolkits.file_write_toolkit.FileWriteToolkit._write_csv_file"></a>
@@ -267,7 +436,7 @@ and HTML (.html, .htm).
- **content** (Union[str, List[List[str]]]): The content to write to the file. Content format varies by file type: - Text formats (txt, md, html, yaml): string - CSV: string or list of lists - JSON: string or serializable object
- **filename** (str): The name or path of the file. If a relative path is supplied, it is resolved to self.output_dir.
- **encoding** (Optional[str]): The character encoding to use. (default: :obj: `None`)
-- **use_latex** (bool): For PDF files, whether to use LaTeX rendering. Only recommended for documents with mathematical formulas or complex typesetting needs. (default: :obj:`False`)
+- **use_latex** (bool): Whether to use LaTeX for math rendering. (default: :obj:`False`)
**Returns:**