Advanced Concepts: Memory in Agentic Systems
Agentic AI systems can maintain different types of memory:
Short-term Memory
- Current conversation context
- Recent decisions
- Temporary state information
Long-term Memory
- User preferences
- Historical interactions
- Learned patterns
Episodic Memory
- Specific past events
- Contextual experiences
- Situation-outcome pairs
Semantic Memory
- General knowledge
- Facts and rules
- Domain expertise
Code:
class MemoryState(TypedDict):
short_term: list # Current conversation
long_term: dict # User preferences
episodic: list # Past interactions
def memory_manager(state: MemoryState) -> MemoryState:
"""Manage different types of memory"""
# Update short-term memory
state["short_term"].append(state["current_input"])
# Check if we should store in long-term
if is_important(state["current_input"]):
update_long_term_memory(state)
# Retrieve relevant episodic memories
relevant_memories = retrieve_episodic(state)
state["context"] = relevant_memories
return stateFor a customer service agent, which type of memory would store "Customer prefers email communication"?