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-bot68a27eb60a21
diff --git a/docs/reference/camel.societies.workforce.workforce.md b/docs/reference/camel.societies.workforce.workforce.md
index 47793d0e9..ef16e1b5b 100644
--- a/docs/reference/camel.societies.workforce.workforce.md
+++ b/docs/reference/camel.societies.workforce.workforce.md
@@ -66,6 +66,15 @@ capabilities
- **graceful_shutdown_timeout** (float, optional): The timeout in seconds for graceful shutdown when a task fails 3 times. During this period, the workforce remains active for debugging. Set to 0 for immediate shutdown. (default: :obj:`15.0`)
- **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`)
+**Note:**
+
+When custom coordinator_agent or task_agent are provided, the workforce
+will preserve the user's system message and append the required
+workforce coordination or task planning instructions to it. This
+ensures both the user's intent is preserved and proper workforce
+functionality is maintained. All other agent configurations (model,
+memory, tools, etc.) will also be preserved.
+
<a id="camel.societies.workforce.workforce.Workforce.__init__"></a>
### __init__
@@ -130,6 +139,20 @@ def _sync_shared_memory(self):
Synchronize memory across all agents by collecting and sharing.
+<a id="camel.societies.workforce.workforce.Workforce._cleanup_task_tracking"></a>
+
+### _cleanup_task_tracking
+
+```python
+def _cleanup_task_tracking(self, task_id: str):
+```
+
+Clean up tracking data for a task to prevent memory leaks.
+
+**Parameters:**
+
+- **task_id** (str): The ID of the task to clean up.
+
<a id="camel.societies.workforce.workforce.Workforce._decompose_task"></a>
### _decompose_task
@@ -358,7 +381,7 @@ def add_single_agent_worker(
self,
description: str,
worker: ChatAgent,
- pool_max_size: int = 10
+ pool_max_size: int = DEFAULT_WORKER_POOL_SIZE
):
```
diff --git a/docs/reference/camel.tasks.task.md b/docs/reference/camel.tasks.task.md
index 21bed3386..80f080b3d 100644
--- a/docs/reference/camel.tasks.task.md
+++ b/docs/reference/camel.tasks.task.md
@@ -1,27 +1,66 @@
<a id="camel.tasks.task"></a>
+<a id="camel.tasks.task.TaskValidationMode"></a>
+
+## TaskValidationMode
+
+```python
+class TaskValidationMode(Enum):
+```
+
+Validation modes for different use cases.
+
<a id="camel.tasks.task.validate_task_content"></a>
## validate_task_content
```python
-def validate_task_content(content: str, task_id: str = 'unknown', min_length: int = 10):
+def validate_task_content(
+ content: str,
+ task_id: str = 'unknown',
+ min_length: int = 5,
+ mode: TaskValidationMode = TaskValidationMode.INPUT,
+ check_failure_patterns: bool = True
+):
```
-Validates task result content to avoid silent failures.
-It performs basic checks to ensure the content meets minimum
-quality standards.
+Unified validation for task content and results to avoid silent
+failures. Performs comprehensive checks to ensure content meets quality
+standards.
**Parameters:**
-- **content** (str): The task result content to validate.
+- **content** (str): The task content or result to validate.
- **task_id** (str): Task ID for logging purposes. (default: :obj:`"unknown"`)
-- **min_length** (int): Minimum content length after stripping whitespace. (default: :obj:`10`)
+- **min_length** (int): Minimum content length after stripping whitespace. (default: :obj:`5`)
+- **mode** (TaskValidationMode): Validation mode - INPUT for task content, OUTPUT for task results. (default: :obj:`TaskValidationMode.INPUT`)
+- **check_failure_patterns** (bool): Whether to check for failure indicators in the content. Only effective in OUTPUT mode. (default: :obj:`True`)
**Returns:**
bool: True if content passes validation, False otherwise.
+<a id="camel.tasks.task.is_task_result_insufficient"></a>
+
+## is_task_result_insufficient
+
+```python
+def is_task_result_insufficient(task: 'Task'):
+```
+
+Check if a task result is insufficient and should be treated as failed.
+
+This is a convenience wrapper around validate_task_content for backward
+compatibility and semantic clarity when checking task results.
+
+**Parameters:**
+
+- **task** (Task): The task to check.
+
+**Returns:**
+
+ bool: True if the result is insufficient, False otherwise.
+
<a id="camel.tasks.task.parse_response"></a>
## parse_response
@@ -77,6 +116,7 @@ Task is specific assignment that can be passed to a agent.
- **subtasks** (List[Task]): The childrent sub-tasks for the task. (default: :obj:`[]`)
- **result** (Optional[str]): The answer for the task. (default: :obj:`""`)
- **failure_count** (int): The failure count for the task. (default: :obj:`0`)
+- **assigned_worker_id** (Optional[str]): The ID of the worker assigned to this task. (default: :obj:`None`)
- **additional_info** (Optional[Dict[str, Any]]): Additional information for the task. (default: :obj:`None`)
- **image_list** (Optional[List[Image.Image]]): Optional list of PIL Image objects associated with the task. (default: :obj:`None`)
- **image_detail** (`Literal["auto", "low", "high"]`): Detail level of the images associated with the task. (default: :obj:`auto`)
diff --git a/docs/reference/camel.toolkits.human_toolkit.md b/docs/reference/camel.toolkits.human_toolkit.md
new file mode 100644
index 000000000..34d8e1527
--- /dev/null
+++ b/docs/reference/camel.toolkits.human_toolkit.md
@@ -0,0 +1,75 @@
+<a id="camel.toolkits.human_toolkit"></a>
+
+<a id="camel.toolkits.human_toolkit.HumanToolkit"></a>
+
+## HumanToolkit
+
+```python
+class HumanToolkit(BaseToolkit):
+```
+
+A class representing a toolkit for human interaction.
+
+<a id="camel.toolkits.human_toolkit.HumanToolkit.ask_human_via_console"></a>
+
+### ask_human_via_console
+
+```python
+def ask_human_via_console(self, question: str):
+```
+
+Use this tool to ask a question to the user when you are stuck,
+need clarification, or require a decision to be made. This is a
+two-way communication channel that will wait for the user's response.
+You should use it to:
+- Clarify ambiguous instructions or requirements.
+- Request missing information that you cannot find (e.g., login
+credentials, file paths).
+- Ask for a decision when there are multiple viable options.
+- Seek help when you encounter an error you cannot resolve on your own.
+
+**Parameters:**
+
+- **question** (str): The question to ask the user.
+
+**Returns:**
+
+ str: The user's response to the question.
+
+<a id="camel.toolkits.human_toolkit.HumanToolkit.send_message_to_user"></a>
+
+### send_message_to_user
+
+```python
+def send_message_to_user(self, message: str):
+```
+
+Use this tool to send a message to the user to keep them
+informed about your progress, decisions, or actions.
+This is a one-way communication channel from you to the user and does
+not require a response. You should use it to:
+- Announce what you are about to do
+(e.g., "I will now search for papers on GUI Agents.")
+- Report the result of an action
+(e.g., "I have found 15 relevant papers.")
+- State a decision
+(e.g., "I will now analyze the top 10 papers.")
+- Inform the user about your current state if you are performing a
+task.
+
+**Parameters:**
+
+- **message** (str): The message to send to the user.
+
+<a id="camel.toolkits.human_toolkit.HumanToolkit.get_tools"></a>
+
+### get_tools
+
+```python
+def get_tools(self):
+```
+
+**Returns:**
+
+ List[FunctionTool]: A list of FunctionTool objects
+representing the functions in the toolkit.
diff --git a/docs/reference/camel.toolkits.non_visual_browser_toolkit.nv_browser_session.md b/docs/reference/camel.toolkits.non_visual_browser_toolkit.nv_browser_session.md
index 7a3a137ca..bd74fa5f9 100644
--- a/docs/reference/camel.toolkits.non_visual_browser_toolkit.nv_browser_session.md
+++ b/docs/reference/camel.toolkits.non_visual_browser_toolkit.nv_browser_session.md
@@ -15,6 +15,16 @@ It provides a single *Page* instance plus helper utilities (snapshot &
executor). Multiple toolkits or agents can reuse this class without
duplicating Playwright setup code.
+This class is a singleton per event-loop.
+
+<a id="camel.toolkits.non_visual_browser_toolkit.nv_browser_session.NVBrowserSession.__new__"></a>
+
+### __new__
+
+```python
+def __new__(cls):
+```
+
<a id="camel.toolkits.non_visual_browser_toolkit.nv_browser_session.NVBrowserSession.__init__"></a>
### __init__
diff --git a/docs/reference/camel.toolkits.video_download_toolkit.md b/docs/reference/camel.toolkits.video_download_toolkit.md
new file mode 100644
index 000000000..56c10ea15
--- /dev/null
+++ b/docs/reference/camel.toolkits.video_download_toolkit.md
@@ -0,0 +1,134 @@
+<a id="camel.toolkits.video_download_toolkit"></a>
+
+<a id="camel.toolkits.video_download_toolkit._capture_screenshot"></a>
+
+## _capture_screenshot
+
+```python
+def _capture_screenshot(video_file: str, timestamp: float):
+```
+
+Capture a screenshot from a video file at a specific timestamp.
+
+**Parameters:**
+
+- **video_file** (str): The path to the video file.
+- **timestamp** (float): The time in seconds from which to capture the screenshot.
+
+**Returns:**
+
+ Image.Image: The captured screenshot in the form of Image.Image.
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit"></a>
+
+## VideoDownloaderToolkit
+
+```python
+class VideoDownloaderToolkit(BaseToolkit):
+```
+
+A class for downloading videos and optionally splitting them into
+chunks.
+
+**Parameters:**
+
+- **download_directory** (Optional[str], optional): The directory where the video will be downloaded to. If not provided, video will be stored in a temporary directory and will be cleaned up after use. (default: :obj:`None`)
+- **cookies_path** (Optional[str], optional): The path to the cookies file for the video service in Netscape format. (default: :obj:`None`)
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit.__init__"></a>
+
+### __init__
+
+```python
+def __init__(
+ self,
+ download_directory: Optional[str] = None,
+ cookies_path: Optional[str] = None,
+ timeout: Optional[float] = None
+):
+```
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit.__del__"></a>
+
+### __del__
+
+```python
+def __del__(self):
+```
+
+Deconstructor for the VideoDownloaderToolkit class.
+
+Cleans up the downloaded video if they are stored in a temporary
+directory.
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit.download_video"></a>
+
+### download_video
+
+```python
+def download_video(self, url: str):
+```
+
+Download the video and optionally split it into chunks.
+
+yt-dlp will detect if the video is downloaded automatically so there
+is no need to check if the video exists.
+
+**Parameters:**
+
+- **url** (str): The URL of the video to download.
+
+**Returns:**
+
+ str: The path to the downloaded video file.
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit.get_video_bytes"></a>
+
+### get_video_bytes
+
+```python
+def get_video_bytes(self, video_path: str):
+```
+
+Download video by the path, and return the content in bytes.
+
+**Parameters:**
+
+- **video_path** (str): The path to the video file.
+
+**Returns:**
+
+ bytes: The video file content in bytes.
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit.get_video_screenshots"></a>
+
+### get_video_screenshots
+
+```python
+def get_video_screenshots(self, video_path: str, amount: int):
+```
+
+Capture screenshots from the video at specified timestamps or by
+dividing the video into equal parts if an integer is provided.
+
+**Parameters:**
+
+- **video_path** (str): The local path or URL of the video to take screenshots.
+- **amount** (int): the amount of evenly split screenshots to capture.
+
+**Returns:**
+
+ List[Image.Image]: A list of screenshots as Image.Image.
+
+<a id="camel.toolkits.video_download_toolkit.VideoDownloaderToolkit.get_tools"></a>
+
+### get_tools
+
+```python
+def get_tools(self):
+```
+
+**Returns:**
+
+ List[FunctionTool]: A list of FunctionTool objects representing
+the functions in the toolkit.