Documentation Index
Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
Use this file to discover all available pages before exploring further.
class MemoryToolkit(BaseToolkit):
A toolkit that provides methods for saving, loading, and clearing a
ChatAgent’s memory.
These methods are exposed as FunctionTool objects for
function calling. Internally, it calls:
- agent.save_memory(path)
- agent.load_memory(new_memory_obj)
- agent.load_memory_from_path(path)
- agent.clear_memory()
Parameters:
- agent (ChatAgent): The chat agent whose memory will be managed.
- timeout (Optional[float], optional): Maximum execution time allowed for toolkit operations in seconds. If None, no timeout is applied. (default: :obj:
None)
init
def __init__(self, agent: 'ChatAgent', timeout: Optional[float] = None):
save
def save(self, path: str):
Saves the agent’s current memory to a JSON file.
Parameters:
- path (str): The file path to save the memory to.
Returns:
str: Confirmation message.
load
def load(self, memory_json: str):
Loads memory into the agent from a JSON string.
Parameters:
- memory_json (str): A JSON string containing memory records.
Returns:
str: Confirmation or error message.
load_from_path
def load_from_path(self, path: str):
Loads the agent’s memory from a JSON file.
Parameters:
- path (str): The file path to load the memory from.
Returns:
str: Confirmation message.
clear_memory
Returns:
str: Confirmation message.
Returns:
list[FunctionTool]: List of FunctionTool objects.