🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
Auto-update documentation after merge [skip ci]
camel-docs-bot1990b8102e7c
diff --git a/docs/mintlify/reference/camel.agents.chat_agent.mdx b/docs/mintlify/reference/camel.agents.chat_agent.mdxindex cc0319970..495dbb420 100644--- a/docs/mintlify/reference/camel.agents.chat_agent.mdx+++ b/docs/mintlify/reference/camel.agents.chat_agent.mdx@@ -249,6 +249,7 @@ Class for managing conversations of CAMEL Chat Agents.- **mask_tool_output** (Optional[bool]): Whether to return a sanitized placeholder instead of the raw tool output. (default: :obj:`False`)- **pause_event** (Optional[Union[threading.Event, asyncio.Event]]): Event to signal pause of the agent's operation. When clear, the agent will pause its execution. Use threading.Event for sync operations or asyncio.Event for async operations. (default: :obj:`None`)- **prune_tool_calls_from_memory** (bool): Whether to clean tool call messages from memory after response generation to save token usage. When enabled, removes FUNCTION/TOOL role messages and ASSISTANT messages with tool_calls after each step. (default: :obj:`False`)+- **enable_snapshot_clean** (bool, optional): Whether to clean snapshot markers and references from historical tool outputs in memory. This removes verbose DOM markers (like [ref=...]) from older tool results while keeping the latest output intact for immediate use. (default: :obj:`False`)- **retry_attempts** (int, optional): Maximum number of retry attempts for rate limit errors. (default: :obj:`3`)- **retry_delay** (float, optional): Initial delay in seconds between retries. Uses exponential backoff. (default: :obj:`1.0`)- **step_timeout** (Optional[float], optional): Timeout in seconds for the entire step operation. If None, no timeout is applied. (default: :obj:`None`)@@ -281,6 +282,7 @@ def __init__(mask_tool_output: bool = False,pause_event: Optional[Union[threading.Event, asyncio.Event]] = None,prune_tool_calls_from_memory: bool = False,+ enable_snapshot_clean: bool = False,retry_attempts: int = 3,retry_delay: float = 1.0,step_timeout: Optional[float] = None,@@ -587,6 +589,124 @@ def add_tools(self, tools: List[Union[FunctionTool, Callable]]):Add a list of tools to the agent.+<a id="camel.agents.chat_agent.ChatAgent._serialize_tool_result"></a>++### _serialize_tool_result++```python+def _serialize_tool_result(self, result: Any):+```++<a id="camel.agents.chat_agent.ChatAgent._clean_snapshot_line"></a>++### _clean_snapshot_line++```python+def _clean_snapshot_line(self, line: str):+```++Clean a single snapshot line by removing prefixes and references.++This method handles snapshot lines in the format:+- [prefix] "quoted text" [attributes] [ref=...]: description++It preserves:+- Quoted text content (including brackets inside quotes)+- Description text after the colon++It removes:+- Line prefixes (e.g., "- button", "- tooltip", "generic:")+- Attribute markers (e.g., [disabled], [ref=e47])+- Lines with only element types+- All indentation++**Parameters:**++- **line**: The original line content.++**Returns:**++ The cleaned line content, or empty string if line should be+removed.++<a id="camel.agents.chat_agent.ChatAgent._clean_snapshot_content"></a>++### _clean_snapshot_content++```python+def _clean_snapshot_content(self, content: str):+```++Clean snapshot content by removing prefixes, references, and+deduplicating lines.++This method identifies snapshot lines (containing element keywords or+references) and cleans them while preserving non-snapshot content.+It also handles JSON-formatted tool outputs with snapshot fields.++**Parameters:**++- **content**: The original snapshot content.++**Returns:**++ The cleaned content with deduplicated lines.++<a id="camel.agents.chat_agent.ChatAgent._clean_text_snapshot"></a>++### _clean_text_snapshot++```python+def _clean_text_snapshot(self, content: str):+```++Clean plain text snapshot content.++This method:+- Removes all indentation+- Deletes empty lines+- Deduplicates all lines+- Cleans snapshot-specific markers++**Parameters:**++- **content**: The original snapshot text.++**Returns:**++ The cleaned content with deduplicated lines, no indentation,+and no empty lines.++<a id="camel.agents.chat_agent.ChatAgent._register_tool_output_for_cache"></a>++### _register_tool_output_for_cache++```python+def _register_tool_output_for_cache(+ self,+ func_name: str,+ tool_call_id: str,+ result_text: str,+ records: List[MemoryRecord]+):+```++<a id="camel.agents.chat_agent.ChatAgent._process_tool_output_cache"></a>++### _process_tool_output_cache++```python+def _process_tool_output_cache(self):+```++<a id="camel.agents.chat_agent.ChatAgent._clean_snapshot_in_memory"></a>++### _clean_snapshot_in_memory++```python+def _clean_snapshot_in_memory(self, entry: _ToolOutputHistoryEntry):+```+<a id="camel.agents.chat_agent.ChatAgent.add_external_tool"></a>### add_external_tool@@ -650,7 +770,8 @@ def update_memory(self,message: BaseMessage,role: OpenAIBackendRole,- timestamp: Optional[float] = None+ timestamp: Optional[float] = None,+ return_records: bool = False):```@@ -660,7 +781,13 @@ Updates the agent memory with a new message.- **message** (BaseMessage): The new message to add to the stored messages.- **role** (OpenAIBackendRole): The backend role type.-- **timestamp** (Optional[float], optional): Custom timestamp for the memory record. If `None`, the current time will be used. (default: :obj:`None`) (default: obj:`None`)+- **timestamp** (Optional[float], optional): Custom timestamp for the memory record. If `None`, the current time will be used. (default: :obj:`None`)+- **return_records** (bool, optional): When `__INLINE_CODE_0____INLINE_CODE_1__False`)++**Returns:**++ Optional[List[MemoryRecord]]: The records that were written when+`__INLINE_CODE_0____INLINE_CODE_1____INLINE_CODE_2____INLINE_CODE_3____INLINE_CODE_4__`.<a id="camel.agents.chat_agent.ChatAgent.load_memory"></a>