Package akka.javasdk.agent
Interface MemoryProvider
- All Known Implementing Classes:
MemoryProvider.CustomMemoryProvider
,MemoryProvider.Disabled
,MemoryProvider.FromConfig
,MemoryProvider.LimitedWindowMemoryProvider
public sealed interface MemoryProvider
permits MemoryProvider.FromConfig, MemoryProvider.Disabled, MemoryProvider.LimitedWindowMemoryProvider, MemoryProvider.CustomMemoryProvider
Interface for configuring memory management in agent systems.
MemoryProvider defines how session history is stored and retrieved during agent interactions. It offers several implementation strategies:
- Limited window memory management via
MemoryProvider.LimitedWindowMemoryProvider
- Custom memory implementation via
MemoryProvider.CustomMemoryProvider
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
Memory provider that uses a custom SessionMemory implementation.static final record
Disabled memory provider, which does not store or retrieve contextual history.static final record
Configuration-based memory provider that reads settings from the specified path.static final record
Memory provider that limits session history based on size or message count. -
Method Summary
Static MethodsModifier and TypeMethodDescriptioncustom
(SessionMemory sessionMemory) Creates a custom memory provider using the specified SessionMemory implementation.static MemoryProvider
Creates a configuration-based memory provider based on configuration defaults.static MemoryProvider
fromConfig
(String configPath) Creates a memory provider based on configuration settings.Creates a limited window memory provider with default settings.static MemoryProvider.Disabled
none()
Disabled memory provider, which does not store or retrieve contextual history.
-
Method Details
-
fromConfig
Creates a configuration-based memory provider based on configuration defaults.- Returns:
- A configuration-based model provider
-
fromConfig
Creates a memory provider based on configuration settings.- Parameters:
configPath
- Path to the configuration. If empty, uses the default path "akka.javasdk.agent.memory"- Returns:
- A configuration-based model provider
-
none
Disabled memory provider, which does not store or retrieve contextual history.- Returns:
- A memory provider without memory.
-
limitedWindow
Creates a limited window memory provider with default settings.The default settings are:
- Include all session history in each interaction with the model
- Record all interactions into memory
- Returns:
- A new limited window memory provider with default settings
-
custom
Creates a custom memory provider using the specified SessionMemory implementation.This allows for complete customization of memory management behavior.
- Parameters:
sessionMemory
- The custom SessionMemory implementation- Returns:
- A new custom memory provider
-