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-bot1d90c47eb7a0
diff --git a/docs/reference/camel.agents.chat_agent.md b/docs/reference/camel.agents.chat_agent.md
index 186d0f2c1..5727c047f 100644
--- a/docs/reference/camel.agents.chat_agent.md
+++ b/docs/reference/camel.agents.chat_agent.md
@@ -556,6 +556,18 @@ def _convert_to_chatagent_response(
Parse the final model response into the chat agent response.
+<a id="camel.agents.chat_agent.ChatAgent._process_pending_images"></a>
+
+### _process_pending_images
+
+```python
+def _process_pending_images(self):
+```
+
+**Returns:**
+
+ List: List of successfully converted PIL Images.
+
<a id="camel.agents.chat_agent.ChatAgent._record_final_output"></a>
### _record_final_output
@@ -566,6 +578,37 @@ def _record_final_output(self, output_messages: List[BaseMessage]):
Log final messages or warnings about multiple responses.
+<a id="camel.agents.chat_agent.ChatAgent._is_vision_error"></a>
+
+### _is_vision_error
+
+```python
+def _is_vision_error(self, exc: Exception):
+```
+
+Check if the exception is likely related to vision/image is not
+supported by the model.
+
+<a id="camel.agents.chat_agent.ChatAgent._has_images"></a>
+
+### _has_images
+
+```python
+def _has_images(self, messages: List[OpenAIMessage]):
+```
+
+Check if any message contains images.
+
+<a id="camel.agents.chat_agent.ChatAgent._strip_images_from_messages"></a>
+
+### _strip_images_from_messages
+
+```python
+def _strip_images_from_messages(self, messages: List[OpenAIMessage]):
+```
+
+Remove images from messages, keeping only text content.
+
<a id="camel.agents.chat_agent.ChatAgent._get_model_response"></a>
### _get_model_response
diff --git a/docs/reference/camel.toolkits.hybrid_browser_toolkit.actions.md b/docs/reference/camel.toolkits.hybrid_browser_toolkit.actions.md
index 2f3759a2f..fe04fb51f 100644
--- a/docs/reference/camel.toolkits.hybrid_browser_toolkit.actions.md
+++ b/docs/reference/camel.toolkits.hybrid_browser_toolkit.actions.md
@@ -25,3 +25,5 @@ def __init__(self, page: 'Page'):
```python
def should_update_snapshot(action: Dict[str, Any]):
```
+
+Determine if an action requires a snapshot update.
diff --git a/docs/reference/camel.toolkits.hybrid_browser_toolkit.agent.md b/docs/reference/camel.toolkits.hybrid_browser_toolkit.agent.md
index bd9963a89..f166c3ed1 100644
--- a/docs/reference/camel.toolkits.hybrid_browser_toolkit.agent.md
+++ b/docs/reference/camel.toolkits.hybrid_browser_toolkit.agent.md
@@ -39,6 +39,16 @@ def _safe_parse_json(self, content: str):
Safely parse JSON from LLM response with multiple fallback
strategies.
+<a id="camel.toolkits.hybrid_browser_toolkit.agent.PlaywrightLLMAgent._get_fallback_response"></a>
+
+### _get_fallback_response
+
+```python
+def _get_fallback_response(self, error_msg: str):
+```
+
+Generate a fallback response structure.
+
<a id="camel.toolkits.hybrid_browser_toolkit.agent.PlaywrightLLMAgent._llm_call"></a>
### _llm_call
diff --git a/docs/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.md b/docs/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.md
index a3c5e414c..ab902161f 100644
--- a/docs/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.md
+++ b/docs/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.md
@@ -8,8 +8,14 @@
class HybridBrowserToolkit(BaseToolkit):
```
-A lightweight, *non-visual* browser toolkit exposing primitive
-Playwright actions as CAMEL `FunctionTool`s.
+A hybrid browser toolkit that combines non-visual, DOM-based browser
+automation with visual, screenshot-based capabilities.
+
+This toolkit exposes a set of actions as CAMEL FunctionTools for agents
+to interact with web pages. It can operate in headless mode and supports
+both programmatic control of browser actions (like clicking and typing)
+and visual analysis of the page layout through screenshots with marked
+interactive elements.
<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit.__init__"></a>
@@ -19,6 +25,16 @@ Playwright actions as CAMEL `FunctionTool`s.
def __init__(self):
```
+Initialize the HybridBrowserToolkit.
+
+**Parameters:**
+
+- **headless** (bool): Whether to run the browser in headless mode. Defaults to `True`.
+- **user_data_dir** (Optional[str]): Path to a directory for storing browser data like cookies and local storage. Useful for maintaining sessions across runs. Defaults to `None` (a temporary directory is used).
+- **web_agent_model** (Optional[BaseModelBackend]): The language model backend to use for the high-level `solve_task` agent. This is required only if you plan to use `solve_task`. Defaults to `None`.
+- **cache_dir** (str): The directory to store cached files, such as screenshots. Defaults to `"tmp/"`.
+- **enabled_tools** (Optional[List[str]]): List of tool names to enable. If None, uses DEFAULT_TOOLS. Available tools: open_browser, close_browser, visit_page, get_page_snapshot, get_som_screenshot, get_page_links, click, type, select, scroll, enter, wait_user, solve_task. Defaults to `None`.
+
<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit.__del__"></a>
### __del__
@@ -27,17 +43,17 @@ def __init__(self):
def __del__(self):
```
-Best-effort cleanup when toolkit is garbage collected.
+Cleanup browser resources on garbage collection.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._load_unified_analyzer"></a>
+
+### _load_unified_analyzer
+
+```python
+def _load_unified_analyzer(self):
+```
-1. We *avoid* running during the Python interpreter shutdown phase
-(`sys.is_finalizing()`), because the import machinery and/or event
-loop may already be torn down which leads to noisy exceptions such
-as `ImportError: sys.meta_path is None` or
-`RuntimeError: Event loop is closed`.
-2. We protect all imports and event-loop operations with defensive
-`try/except` blocks. This ensures that, even if cleanup cannot be
-carried out, we silently ignore the failure instead of polluting
-stderr on program exit.
+Load the unified analyzer JavaScript script.
<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._validate_ref"></a>
@@ -47,7 +63,37 @@ stderr on program exit.
def _validate_ref(self, ref: str, method_name: str):
```
-Validate that ref parameter is a non-empty string.
+Validate ref parameter.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._convert_analysis_to_rects"></a>
+
+### _convert_analysis_to_rects
+
+```python
+def _convert_analysis_to_rects(self, analysis_data: Dict[str, Any]):
+```
+
+Convert analysis data to rect format for visual marking.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._add_set_of_mark"></a>
+
+### _add_set_of_mark
+
+```python
+def _add_set_of_mark(self, image, rects):
+```
+
+Add visual marks to the image.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._format_snapshot_from_analysis"></a>
+
+### _format_snapshot_from_analysis
+
+```python
+def _format_snapshot_from_analysis(self, analysis_data: Dict[str, Any]):
+```
+
+Format analysis data into snapshot string.
<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._ensure_agent"></a>
@@ -57,8 +103,7 @@ Validate that ref parameter is a non-empty string.
def _ensure_agent(self):
```
-Create PlaywrightLLMAgent on first use if `web_agent_model`
-provided.
+Create PlaywrightLLMAgent on first use.
<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit.get_tools"></a>
@@ -67,3 +112,6 @@ provided.
```python
def get_tools(self):
```
+
+Get available function tools
+based on enabled_tools configuration.
diff --git a/docs/reference/camel.types.agents.tool_calling_record.md b/docs/reference/camel.types.agents.tool_calling_record.md
new file mode 100644
index 000000000..d1b97dbba
--- /dev/null
+++ b/docs/reference/camel.types.agents.tool_calling_record.md
@@ -0,0 +1,43 @@
+<a id="camel.types.agents.tool_calling_record"></a>
+
+<a id="camel.types.agents.tool_calling_record.ToolCallingRecord"></a>
+
+## ToolCallingRecord
+
+```python
+class ToolCallingRecord(BaseModel):
+```
+
+Historical records of tools called in the conversation.
+
+**Parameters:**
+
+- **func_name** (str): The name of the tool being called.
+- **args** (Dict[str, Any]): The dictionary of arguments passed to the tool.
+- **result** (Any): The execution result of calling this tool.
+- **tool_call_id** (str): The ID of the tool call, if available.
+- **images** (Optional[List[str]]): List of base64-encoded images returned by the tool, if any.
+
+<a id="camel.types.agents.tool_calling_record.ToolCallingRecord.__str__"></a>
+
+### __str__
+
+```python
+def __str__(self):
+```
+
+**Returns:**
+
+ str: Modified string to represent the tool calling.
+
+<a id="camel.types.agents.tool_calling_record.ToolCallingRecord.as_dict"></a>
+
+### as_dict
+
+```python
+def as_dict(self):
+```
+
+**Returns:**
+
+ dict[str, Any]: The tool calling record as a dictionary.
diff --git a/docs/reference/camel.utils.tool_result.md b/docs/reference/camel.utils.tool_result.md
new file mode 100644
index 000000000..97e366f19
--- /dev/null
+++ b/docs/reference/camel.utils.tool_result.md
@@ -0,0 +1,49 @@
+<a id="camel.utils.tool_result"></a>
+
+<a id="camel.utils.tool_result.ToolResult"></a>
+
+## ToolResult
+
+```python
+class ToolResult:
+```
+
+Special result type for tools that can return images along with text.
+
+This class is used by ChatAgent to detect when a tool returns visual
+content that should be included in the conversation context.
+
+<a id="camel.utils.tool_result.ToolResult.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self, text: str, images: Optional[List[str]] = None):
+```
+
+Initialize a tool result.
+
+**Parameters:**
+
+- **text** (str): The text description or result of the tool operation.
+- **images** (Optional[List[str]]): List of base64-encoded images to include in the conversation context. Images should be encoded as "data:image/\{format\};base64,\{data\}" format.
+
+<a id="camel.utils.tool_result.ToolResult.__str__"></a>
+
+### __str__
+
+```python
+def __str__(self):
+```
+
+Return the text representation of the result.
+
+<a id="camel.utils.tool_result.ToolResult.__repr__"></a>
+
+### __repr__
+
+```python
+def __repr__(self):
+```
+
+Return a detailed representation of the result.