The Memory Systems Database defines how MOOD MNKY agents store, retain, and recall information across interactions. It provides the architecture for context retention, personalization, and continuous learning that enables agents to deliver coherent, personalized experiences.
The Memory Systems Database defines “how” agents remember, enabling them to maintain context, recall past interactions, and deliver personalized experiences.
from agents import Agent, Tool, Runnerfrom memory_system import MemorySystem# Initialize memory systemmemory = MemorySystem()# Define memory creation tooldef store_memory(content: str, memory_type: str, importance: float = 0.5, tags: list = None, user_id: str = None) -> dict: """Store information in the agent's memory.""" return memory.create( content=content, memory_type=memory_type, importance=importance, tags=tags or [], user_id=user_id )# Create tool for the agentmemory_tool = Tool( name="store_memory", description="Store important information in memory", function=store_memory)# Create agent with the toolagent = Agent( name="MOOD MNKY", instructions="You are MOOD MNKY, the brand assistant. Remember important information about users.", tools=[memory_tool])# Run the agentrunner = Runner()result = await runner.run(agent, "I have sensitive skin and prefer fragrance-free products")
from agents import Agent, Tool, Runnerfrom memory_system import MemorySystem# Initialize memory systemmemory = MemorySystem()# Define memory retrieval tooldef retrieve_memories(query: str, memory_type: str = None, limit: int = 5, user_id: str = None) -> list: """Retrieve relevant memories based on the query.""" return memory.search( query=query, memory_type=memory_type, limit=limit, user_id=user_id )# Create tool for the agentretrieval_tool = Tool( name="retrieve_memories", description="Recall relevant information from memory", function=retrieve_memories)# Create agent with the toolagent = Agent( name="MOOD MNKY", instructions="You are MOOD MNKY, the brand assistant. Use your memory to provide personalized assistance.", tools=[retrieval_tool])# Run the agentrunner = Runner()result = await runner.run(agent, "What products would you recommend for me?")
from agents import Agent, Runnerfrom memory_system import MemorySystem# Initialize memory systemmemory = MemorySystem()async def create_memory_aware_agent(user_id: str) -> Agent: # Retrieve relevant memories for the user user_memories = memory.get_user_summary(user_id) # Create agent with memory-infused instructions agent = Agent( name="MOOD MNKY", instructions=f"""You are MOOD MNKY, the brand assistant. What you know about this user: {user_memories} Use this information to provide personalized assistance.""" ) return agent# Create and run agent for a specific useragent = await create_memory_aware_agent("usr_425b3c")runner = Runner()result = await runner.run(agent, "Can you recommend something new for me to try?")
from agents import Agent, Runnerfrom agents.mcp.server import MCPServerSse, MCPServerSseParams# Set up MCP server for memory systemasync with MCPServerSse( params=MCPServerSseParams( url="http://localhost:3000/memory-mcp", headers={"Authorization": f"Bearer {API_KEY}"} ), name="memory_mcp", cache_tools_list=True) as memory_server: # Create agent with memory MCP server agent = Agent( name="MOOD MNKY", instructions="You are MOOD MNKY, the brand assistant. Use your memory to provide personalized assistance.", mcp_servers=[memory_server] ) # Run the agent runner = Runner() result = await runner.run(agent, "What was that candle I liked last time?")
The process of creating new memories from interactions, observations, and explicit information. Includes relevance assessment, metadata tagging, and importance scoring.
Storage
The organization and persistence of memories across different systems based on memory type, including vector databases for semantic retrieval and optimized storage strategies.
Retrieval
The process of accessing relevant memories based on context, query, or task needs, using semantic search, recency weighting, and importance factors.
Consolidation
The workflow that transfers information between memory types, summarizes recurring patterns, and optimizes long-term storage for effective recall.
Forgetting
The controlled expiration of low-value or outdated memories to maintain system efficiency and comply with privacy requirements.
Reflection
The process of analyzing, connecting, and deriving insights from existing memories to improve future interactions and predictions.