Class EpisodicMemory
java.lang.Object
com.tnsai.coordination.production.EpisodicMemory
Cross-agent episodic memory for recording and querying interaction episodes.
Enables agents to learn from past coordination patterns.
Example usage:
EpisodicMemory memory = new EpisodicMemory(1000);
memory.record(Episode.of("task-1", "agent-a", "translate", "success", Map.of("lang", "fr")));
List<Episode> similar = memory.querySimilar("translate", 5);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA single interaction episode. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionall()Returns all episodes as an unmodifiable list.voidclear()Clears all episodes.queryByAgent(String agentId, int limit) Queries episodes by agent ID.queryByOutcome(String outcome, int limit) Queries episodes by outcome (e.g., "success", "failure").querySimilar(String taskType, int limit) Queries episodes matching a task type keyword.voidrecord(EpisodicMemory.Episode episode) Records a new episode, evicting the oldest if capacity is reached.intsize()Returns the total number of recorded episodes.
-
Constructor Details
-
EpisodicMemory
public EpisodicMemory(int maxEpisodes)
-
-
Method Details
-
record
Records a new episode, evicting the oldest if capacity is reached. -
querySimilar
Queries episodes matching a task type keyword. -
queryByAgent
Queries episodes by agent ID. -
queryByOutcome
Queries episodes by outcome (e.g., "success", "failure"). -
size
public int size()Returns the total number of recorded episodes. -
all
Returns all episodes as an unmodifiable list. -
clear
public void clear()Clears all episodes.
-