Episodic Memory
Understanding Episodic Memory?
Episodic memory refers to the ability to recall specific personal experiences, events, or episodes in vivid detail, including contextual elements like time, place, emotions, and sensory information. Unlike semantic memory (which stores general facts), episodic memory is autobiographical, enabling humans to mentally "re-live" past moments and use them to inform decisions, predict outcomes, or build a coherent sense of self over time. The encoding, consolidation, and retrieval of these event-based memories are often influenced by emotional salience and repetition.
In anthropomorphic agents, episodic memory is simulated through structured data systems that log interactions, actions, and environmental states as timestamped "experiences." These agents might store sensory inputs (e.g., text, images), contextual metadata (e.g., location, time), and emotional or goal-based associations (if programmed with affect models). Retrieval could involve querying these logs to contextualize current tasks, generate relatable narratives ("Remember when we..."), or adapt behavior based on past successes/failures. While human episodic memory is dynamic and prone to distortion, artificial versions prioritize accuracy and relevance, often using databases or graph networks to link events. This creates an illusion of human-like recollection, enhancing user interaction through relatable, story-driven responses, even though the underlying mechanisms lack biological subjectivity.
Types of Episodic Memory
There are two main types of Episodic Memory currently supported in SwiftAgent - Working Memory & Long Term Memory.
Working Memory refers to ephemeral short term memory that an agent has.
Long Term Memory refers to the persistent long term memory that an agent has.
Using Episodic Memory
There are two ways of using episodic memory with SwiftAgent. One way is to simply set the episodic_memory
attribute to True
and it will automatically generate a managed Working Memory & Long Term Memory. This is the recommended and preferred way.
The other way is to separately create separate Working and/or Long Term Memory components and then add them to the agent.
Managed Episodic Memory
from swiftagent import SwiftAgent
agent = SwiftAgent(episodic_memory=True)
Manual Episodic Memory
from swiftagent import SwiftAgent
from swiftagent.memory import WorkingMemory, LongTermMemory
agent = SwiftAgent()
long_term_memory = LongTermMemory(name='sample_long_term_memory')
working_memory = WorkingMemory(max_items=10)
agent.set_working_memory(working_memory)
agent.set_long_term_memory(long_term_memory)
Last updated