Smart Memory is Aegis’s intelligent extraction layer that automatically determines what’s worth remembering from conversations. Instead of storing everything (noise) or requiring manual decisions (burden), Smart Memory uses a two-stage process to extract and store only valuable information.
from aegis_memory import SmartMemory# Initialize with your API keysmemory = SmartMemory( aegis_api_key="your-aegis-key", llm_api_key="your-openai-key")# After each conversation turn, process itmemory.process_turn( user_input="I'm John, a Python developer from Chennai. I prefer dark mode.", ai_response="Nice to meet you, John! I'll remember your preferences.", user_id="user_123")# Later, get relevant context for a new querycontext = memory.get_context( query="What color theme should I use?", user_id="user_123")print(context.context_string)# Output:# - User's name is John# - User is a Python developer# - User is based in Chennai# - User prefers dark mode for applications
For the simplest experience, use SmartAgent which handles everything:
from aegis_memory import SmartAgentagent = SmartAgent( aegis_api_key="your-aegis-key", llm_api_key="your-openai-key", system_prompt="You are a helpful coding assistant.")# Memory is completely automaticresponse = agent.chat("I'm John, I prefer Python over JavaScript", user_id="user_123")response = agent.chat("What language should I use?", user_id="user_123")# Agent automatically knows user prefers Python!