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-bot504be163da7c
diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.json
index cd523156a..e5a52e7a0 100644
--- a/docs/mintlify/docs.json
+++ b/docs/mintlify/docs.json
@@ -517,9 +517,14 @@
"reference/camel.toolkits.zapier_toolkit",
"reference/camel.toolkits.hybrid_browser_toolkit.actions",
"reference/camel.toolkits.hybrid_browser_toolkit.agent",
- "reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit",
"reference/camel.toolkits.hybrid_browser_toolkit.browser_session",
- "reference/camel.toolkits.hybrid_browser_toolkit.snapshot"
+ "reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit",
+ "reference/camel.toolkits.hybrid_browser_toolkit.snapshot",
+ "reference/camel.toolkits.non_visual_browser_toolkit.actions",
+ "reference/camel.toolkits.non_visual_browser_toolkit.agent",
+ "reference/camel.toolkits.non_visual_browser_toolkit.browser_non_visual_toolkit",
+ "reference/camel.toolkits.non_visual_browser_toolkit.nv_browser_session",
+ "reference/camel.toolkits.non_visual_browser_toolkit.snapshot"
]
},
{
@@ -565,6 +570,7 @@
"reference/camel.utils.message_summarizer",
"reference/camel.utils.response_format",
"reference/camel.utils.token_counting",
+ "reference/camel.utils.tool_result",
"reference/camel.utils.chunker.base",
"reference/camel.utils.chunker.code_chunker",
"reference/camel.utils.chunker.uio_chunker"
diff --git a/docs/mintlify/reference/camel.agents.chat_agent.mdx b/docs/mintlify/reference/camel.agents.chat_agent.mdx
index 186d0f2c1..5727c047f 100644
--- a/docs/mintlify/reference/camel.agents.chat_agent.mdx
+++ b/docs/mintlify/reference/camel.agents.chat_agent.mdx
@@ -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/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.actions.mdx b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.actions.mdx
new file mode 100644
index 000000000..fe04fb51f
--- /dev/null
+++ b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.actions.mdx
@@ -0,0 +1,29 @@
+<a id="camel.toolkits.hybrid_browser_toolkit.actions"></a>
+
+<a id="camel.toolkits.hybrid_browser_toolkit.actions.ActionExecutor"></a>
+
+## ActionExecutor
+
+```python
+class ActionExecutor:
+```
+
+Executes high-level actions (click, type …) on a Playwright Page.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.actions.ActionExecutor.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self, page: 'Page'):
+```
+
+<a id="camel.toolkits.hybrid_browser_toolkit.actions.ActionExecutor.should_update_snapshot"></a>
+
+### should_update_snapshot
+
+```python
+def should_update_snapshot(action: Dict[str, Any]):
+```
+
+Determine if an action requires a snapshot update.
diff --git a/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.agent.mdx b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.agent.mdx
new file mode 100644
index 000000000..f166c3ed1
--- /dev/null
+++ b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.agent.mdx
@@ -0,0 +1,66 @@
+<a id="camel.toolkits.hybrid_browser_toolkit.agent"></a>
+
+<a id="camel.toolkits.hybrid_browser_toolkit.agent.PlaywrightLLMAgent"></a>
+
+## PlaywrightLLMAgent
+
+```python
+class PlaywrightLLMAgent:
+```
+
+High-level orchestration: snapshot ↔ LLM ↔ action executor.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.agent.PlaywrightLLMAgent.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self):
+```
+
+<a id="camel.toolkits.hybrid_browser_toolkit.agent.PlaywrightLLMAgent._get_chat_agent"></a>
+
+### _get_chat_agent
+
+```python
+def _get_chat_agent(self):
+```
+
+Get or create the ChatAgent instance.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.agent.PlaywrightLLMAgent._safe_parse_json"></a>
+
+### _safe_parse_json
+
+```python
+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
+
+```python
+def _llm_call(
+ self,
+ prompt: str,
+ snapshot: str,
+ is_initial: bool,
+ history: Optional[List[Dict[str, Any]]] = None
+):
+```
+
+Call the LLM (via CAMEL ChatAgent) to get plan & next action.
diff --git a/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.browser_session.mdx b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.browser_session.mdx
new file mode 100644
index 000000000..8b806536c
--- /dev/null
+++ b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.browser_session.mdx
@@ -0,0 +1,34 @@
+<a id="camel.toolkits.hybrid_browser_toolkit.browser_session"></a>
+
+<a id="camel.toolkits.hybrid_browser_toolkit.browser_session.NVBrowserSession"></a>
+
+## NVBrowserSession
+
+```python
+class NVBrowserSession:
+```
+
+Lightweight wrapper around Playwright for non-visual (headless)
+browsing.
+
+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.hybrid_browser_toolkit.browser_session.NVBrowserSession.__new__"></a>
+
+### __new__
+
+```python
+def __new__(cls):
+```
+
+<a id="camel.toolkits.hybrid_browser_toolkit.browser_session.NVBrowserSession.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self):
+```
diff --git a/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.mdx b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.mdx
new file mode 100644
index 000000000..ab902161f
--- /dev/null
+++ b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.mdx
@@ -0,0 +1,117 @@
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit"></a>
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit"></a>
+
+## HybridBrowserToolkit
+
+```python
+class HybridBrowserToolkit(BaseToolkit):
+```
+
+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>
+
+### __init__
+
+```python
+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__
+
+```python
+def __del__(self):
+```
+
+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):
+```
+
+Load the unified analyzer JavaScript script.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit._validate_ref"></a>
+
+### _validate_ref
+
+```python
+def _validate_ref(self, ref: str, method_name: str):
+```
+
+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>
+
+### _ensure_agent
+
+```python
+def _ensure_agent(self):
+```
+
+Create PlaywrightLLMAgent on first use.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.hybrid_browser_toolkit.HybridBrowserToolkit.get_tools"></a>
+
+### get_tools
+
+```python
+def get_tools(self):
+```
+
+Get available function tools
+based on enabled_tools configuration.
diff --git a/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.snapshot.mdx b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.snapshot.mdx
new file mode 100644
index 000000000..cccf26330
--- /dev/null
+++ b/docs/mintlify/reference/camel.toolkits.hybrid_browser_toolkit.snapshot.mdx
@@ -0,0 +1,46 @@
+<a id="camel.toolkits.hybrid_browser_toolkit.snapshot"></a>
+
+<a id="camel.toolkits.hybrid_browser_toolkit.snapshot.PageSnapshot"></a>
+
+## PageSnapshot
+
+```python
+class PageSnapshot:
+```
+
+Utility for capturing YAML-like page snapshots and diff-only
+variants.
+
+<a id="camel.toolkits.hybrid_browser_toolkit.snapshot.PageSnapshot.__init__"></a>
+
+### __init__
+
+```python
+def __init__(self, page: 'Page'):
+```
+
+<a id="camel.toolkits.hybrid_browser_toolkit.snapshot.PageSnapshot._format_snapshot"></a>
+
+### _format_snapshot
+
+```python
+def _format_snapshot(text: str):
+```
+
+<a id="camel.toolkits.hybrid_browser_toolkit.snapshot.PageSnapshot._compute_diff"></a>
+
+### _compute_diff
+
+```python
+def _compute_diff(old: str, new: str):
+```
+
+<a id="camel.toolkits.hybrid_browser_toolkit.snapshot.PageSnapshot._detect_priorities"></a>
+
+### _detect_priorities
+
+```python
+def _detect_priorities(self, snapshot_yaml: str):
+```
+
+Return sorted list of priorities present (1,2,3).
diff --git a/docs/mintlify/reference/camel.types.agents.tool_calling_record.mdx b/docs/mintlify/reference/camel.types.agents.tool_calling_record.mdx
index e4f64fb77..d1b97dbba 100644
--- a/docs/mintlify/reference/camel.types.agents.tool_calling_record.mdx
+++ b/docs/mintlify/reference/camel.types.agents.tool_calling_record.mdx
@@ -16,6 +16,7 @@ Historical records of tools called in the conversation.
- **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>
diff --git a/docs/mintlify/reference/camel.utils.tool_result.mdx b/docs/mintlify/reference/camel.utils.tool_result.mdx
new file mode 100644
index 000000000..97e366f19
--- /dev/null
+++ b/docs/mintlify/reference/camel.utils.tool_result.mdx
@@ -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.