🐫 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-botaf8984aac62b
diff --git a/docs/key_modules/memory.md b/docs/key_modules/memory.mdindex 26f5f0e2a..009e17c7e 100644--- a/docs/key_modules/memory.md+++ b/docs/key_modules/memory.md@@ -335,6 +335,64 @@ Add [Mem0](https://mem0.ai/) for cloud-based memory with automatic sync.**Use when:** you need reliable, persistent chat history in the cloud (not advanced semantic search).</Card>++<Card title="Memanto Memory" icon="warehouse">+[Memanto](https://docs.memanto.ai) provides semantic long-term memory through+`MemantoMemory`, an implementation of CAMEL's agent memory interface.+`ChatAgent` automatically archives user and assistant text and retrieves+relevant memories using the current user message.++Start a Memanto server and create an agent once:++```bash+pip install memanto+memanto serve+# In another terminal:+memanto agent create my-camel-agent+```++```python+from camel.agents import ChatAgent+from camel.memories import MemantoMemory, ScoreBasedContextCreator+from camel.types import ModelType+from camel.utils import OpenAITokenCounter++memory = MemantoMemory(+ context_creator=ScoreBasedContextCreator(+ OpenAITokenCounter(ModelType.GPT_4O_MINI), token_limit=4096,+ ),+ agent_id="my-camel-agent",+ base_url="http://localhost:8000",+ retrieve_limit=3,+)+try:+ agent = ChatAgent(+ system_message="You are a helpful assistant.",+ agent_id="my-camel-agent",+ memory=memory,+ )+ response = agent.step("I prefer concise Python examples.")+ print(response.msgs[0].content)+finally:+ memory.close()+```++Set `OPENAI_API_KEY` for the default ChatAgent model. `agent_id` and `base_url`+can also be configured through `MEMANTO_AGENT_ID` and `MEMANTO_BASE_URL`.++Complete current conversation records, including system roles, attachments,+and tool calls/results, remain in the configured chat-history storage+(in-memory by default). Memanto stores user/assistant text and returns it as+historical context; it is not a lossless backup of the conversation.++`clear()`, `ChatAgent.reset()`, and rollback operations affect current chat+history only. Archived Memanto memories remain available for later recall.+Manage deletion of archived memories in Memanto. Remote writes and retrieval+can depend on server indexing latency; current user input remains available+in local chat history immediately. HTTP errors are raised to the caller.++See the [memory reference](/reference/camel.memories.memanto).+</Card></Card><Card title="Advanced Topics" icon="star">diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.jsonindex 63b54a525..33a68dc82 100644--- a/docs/mintlify/docs.json+++ b/docs/mintlify/docs.json@@ -383,8 +383,8 @@"group": "Memory","pages": ["reference/camel.memories.agent_memories",- "reference/camel.memories.memanto","reference/camel.memories.base",+ "reference/camel.memories.memanto","reference/camel.memories.records","reference/camel.memories.blocks.chat_history_block","reference/camel.memories.blocks.vectordb_block",diff --git a/docs/mintlify/reference/camel.memories.memanto.mdx b/docs/mintlify/reference/camel.memories.memanto.mdxindex 11651d6c7..9d389273f 100644--- a/docs/mintlify/reference/camel.memories.memanto.mdx+++ b/docs/mintlify/reference/camel.memories.memanto.mdx@@ -1,6 +1,67 @@<a id="camel.memories.memanto"></a>-# Memanto Memory+<a id="camel.memories.memanto._MemantoRESTClient"></a>++## _MemantoRESTClient++```python+class _MemantoRESTClient:+```++Session-aware client for Memanto memory writes and semantic recall.++<a id="camel.memories.memanto._MemantoRESTClient.__init__"></a>++### __init__++```python+def __init__(+ self,+ agent_id: str,+ base_url: str,+ timeout: float+):+```++<a id="camel.memories.memanto._MemantoRESTClient._activate"></a>++### _activate++```python+def _activate(self):+```++<a id="camel.memories.memanto._MemantoRESTClient._request"></a>++### _request++```python+def _request(self, operation: str, payload: Dict[str, Any]):+```++<a id="camel.memories.memanto._MemantoRESTClient.remember"></a>++### remember++```python+def remember(self, content: str, record_id: str):+```++<a id="camel.memories.memanto._MemantoRESTClient.recall"></a>++### recall++```python+def recall(self, query: str, limit: int):+```++<a id="camel.memories.memanto._MemantoRESTClient.close"></a>++### close++```python+def close(self):+```<a id="camel.memories.memanto.MemantoMemory"></a>@@ -10,72 +71,82 @@class MemantoMemory(ChatHistoryMemory):```-Automatic semantic long-term memory for `ChatAgent`. Complete conversation-records use the normal chat-history storage. User and assistant text is also-archived in Memanto, and relevant memories are added as historical context-when generating model input.+Chat history augmented with automatic Memanto semantic memory.++Complete conversation records remain in the chat-history storage. User+and assistant text is also stored in Memanto. Retrieval searches Memanto+using the latest user message and adds matching text as recalled context.+System instructions, tool-call metadata, and attachments are kept in chat+history; Memanto is not a lossless backup of that history.++Clearing or rolling back this memory only changes chat history. Archived+Memanto memories survive agent initialization and conversation resets.+HTTP errors propagate to the caller; a failed remote write leaves the+original records in chat history.**Parameters:**-- **context_creator** (`BaseContextCreator`): Context creation strategy.-- **agent_id** (`str`, optional): Existing Memanto agent ID; falls back to- `MEMANTO_AGENT_ID`. This selects the remote archive at construction time.-- **base_url** (`str`, optional): Memanto server URL; falls back to- `MEMANTO_BASE_URL`, then `http://localhost:8000`.-- **storage** (`BaseKeyValueStorage`, optional): Storage for current chat- history. Defaults to in-memory storage.-- **window_size** (`int`, optional): Recent chat-history window. Defaults to- the complete current conversation.-- **retrieve_limit** (`int`, optional): Maximum semantic recall results,- from 1 to 100. Defaults to 3.-- **timeout** (`float`, optional): HTTP timeout in seconds. Defaults to 30.+- **context_creator** (BaseContextCreator): Creates model context.+- **agent_id** (Optional[str], optional): Existing Memanto agent identifier. Defaults to the MEMANTO_AGENT_ID environment variable.+- **base_url** (Optional[str], optional): Memanto server URL. Defaults to MEMANTO_BASE_URL or http://localhost:8000.+- **storage** (Optional[BaseKeyValueStorage], optional): Chat-history storage. Defaults to in-memory storage.+- **window_size** (Optional[int], optional): Recent chat-history window. Defaults to the complete current conversation.+- **retrieve_limit** (int, optional): Maximum semantic recall results, between 1 and 100. (default: :obj:`3`)+- **timeout** (float, optional): HTTP timeout in seconds. (default: :obj:`30.0`)++<a id="camel.memories.memanto.MemantoMemory.__init__"></a>++### __init__++```python+def __init__(+ self,+ context_creator: BaseContextCreator,+ agent_id: Optional[str] = None,+ base_url: Optional[str] = None,+ storage: Optional[BaseKeyValueStorage] = None,+ window_size: Optional[int] = None,+ retrieve_limit: int = 3,+ timeout: float = 30.0+):+```++<a id="camel.memories.memanto.MemantoMemory.write_records"></a>### write_records```python-def write_records(self, records: List[MemoryRecord]) -> None:+def write_records(self, records: List[MemoryRecord]):```-Stores complete records in chat history, then archives nonempty user and-assistant text in Memanto. System instructions, tool-call metadata, and-attachments stay in chat history. Remote text memories supplement context;-they do not provide exact conversation restoration.+Keep complete chat records and archive conversational text.-HTTP failures propagate. If a remote write fails, the original records remain-in chat history. Session expiration triggers one retry with a fresh token.+<a id="camel.memories.memanto.MemantoMemory.retrieve"></a>### retrieve```python-def retrieve(self) -> List[ContextRecord]:+def retrieve(self):```-Searches Memanto with the latest user message in the chat-history window and-combines matching memories with that history. Memories corresponding to-records already in the window are omitted. Recalled context is placed after-initial instructions and before conversation turns, preserving tool-call and-tool-response pairs.+Combine recent chat history with relevant long-term memories.-Without a user message, retrieval returns chat history without a remote query.+<a id="camel.memories.memanto.MemantoMemory.clear"></a>### clear```python-def clear(self) -> None:+def clear(self):```-Clears current chat history. Remote memories remain available across agent-initialization and resets; delete archived memories through Memanto itself.-Inherited rollback and tool-cleanup operations also affect chat history only.+Clear current chat history while retaining Memanto memories.++<a id="camel.memories.memanto.MemantoMemory.close"></a>### close```python-def close(self) -> None:+def close(self):```-Closes the HTTP client without deleting memory. Call when finished using the-memory instance.--See the [usage example](/key_modules/memory) and-[Memanto documentation](https://docs.memanto.ai).+Close the HTTP client without deleting any memories.diff --git a/docs/reference/camel.memories.memanto.md b/docs/reference/camel.memories.memanto.mdnew file mode 100644index 000000000..11651d6c7--- /dev/null+++ b/docs/reference/camel.memories.memanto.md@@ -0,0 +1,81 @@+<a id="camel.memories.memanto"></a>++# Memanto Memory++<a id="camel.memories.memanto.MemantoMemory"></a>++## MemantoMemory++```python+class MemantoMemory(ChatHistoryMemory):+```++Automatic semantic long-term memory for `ChatAgent`. Complete conversation+records use the normal chat-history storage. User and assistant text is also+archived in Memanto, and relevant memories are added as historical context+when generating model input.++**Parameters:**++- **context_creator** (`BaseContextCreator`): Context creation strategy.+- **agent_id** (`str`, optional): Existing Memanto agent ID; falls back to+ `MEMANTO_AGENT_ID`. This selects the remote archive at construction time.+- **base_url** (`str`, optional): Memanto server URL; falls back to+ `MEMANTO_BASE_URL`, then `http://localhost:8000`.+- **storage** (`BaseKeyValueStorage`, optional): Storage for current chat+ history. Defaults to in-memory storage.+- **window_size** (`int`, optional): Recent chat-history window. Defaults to+ the complete current conversation.+- **retrieve_limit** (`int`, optional): Maximum semantic recall results,+ from 1 to 100. Defaults to 3.+- **timeout** (`float`, optional): HTTP timeout in seconds. Defaults to 30.++### write_records++```python+def write_records(self, records: List[MemoryRecord]) -> None:+```++Stores complete records in chat history, then archives nonempty user and+assistant text in Memanto. System instructions, tool-call metadata, and+attachments stay in chat history. Remote text memories supplement context;+they do not provide exact conversation restoration.++HTTP failures propagate. If a remote write fails, the original records remain+in chat history. Session expiration triggers one retry with a fresh token.++### retrieve++```python+def retrieve(self) -> List[ContextRecord]:+```++Searches Memanto with the latest user message in the chat-history window and+combines matching memories with that history. Memories corresponding to+records already in the window are omitted. Recalled context is placed after+initial instructions and before conversation turns, preserving tool-call and+tool-response pairs.++Without a user message, retrieval returns chat history without a remote query.++### clear++```python+def clear(self) -> None:+```++Clears current chat history. Remote memories remain available across agent+initialization and resets; delete archived memories through Memanto itself.+Inherited rollback and tool-cleanup operations also affect chat history only.++### close++```python+def close(self) -> None:+```++Closes the HTTP client without deleting memory. Call when finished using the+memory instance.++See the [usage example](/key_modules/memory) and+[Memanto documentation](https://docs.memanto.ai).