Package com.tnsai.annotations
Annotation Interface MemorySpec
Memory configuration annotation for Agents.
Defines how the agent manages conversation history and knowledge.
Usage
@AgentSpec(description = "Research assistant")
@MemorySpec(
type = MemoryType.CONVERSATION,
capacity = 100,
pruneStrategy = PruneStrategy.SLIDING_WINDOW
)
public class ResearchAgent extends Agent { ... }
- Author:
- TnsAI Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumMemory types.static enumPersistence backends.static enumPruning strategies. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionintMaximum number of messages/items to store.Redis/Database connection URL (for persistent storage).booleanWhether to include system messages in history.intMaximum tokens for context window management.Persistence backend.Strategy for pruning when capacity is exceeded.booleanWhether to summarize old messages instead of removing.Type of memory store.
-
Element Details
-
type
Type of memory store.- Default:
CONVERSATION
-
capacity
int capacityMaximum number of messages/items to store.The default of 100 is a real, enforced limit — a bare
@MemorySpecprunes at 100 entries. Set to 0 for unbounded storage.- Default:
100
-
pruneStrategy
MemorySpec.PruneStrategy pruneStrategyStrategy for pruning when capacity is exceeded.- Default:
SLIDING_WINDOW
-
persistence
MemorySpec.Persistence persistencePersistence backend.- Default:
IN_MEMORY
-
maxContextTokens
int maxContextTokensMaximum tokens for context window management.0 = no limit.
- Default:
0
-
includeSystemMessages
boolean includeSystemMessagesWhether to include system messages in history.- Default:
false
-
summarizeOnPrune
boolean summarizeOnPruneWhether to summarize old messages instead of removing.- Default:
false
-
connectionUrl
String connectionUrlRedis/Database connection URL (for persistent storage).- Default:
""
-