Feature

Feature companion object that allows installing the AgentMemory feature in an agent.

This object implements AIAgentFeature to provide the necessary functionality for integrating memory capabilities into an agent.

To install the AgentMemory feature in your agent:

val agent = AIAgents(
strategy = myStrategy,
promptExecutor = myExecutor
) {
// Install memory feature with custom configuration
install(AgentMemory) {
// Configure memory provider (required)
memoryProvider = LocalFileMemoryProvider(
config = LocalMemoryConfig("my-agent-memory"),
storage = SimpleStorage(JVMFileSystemProvider),
root = Path("memory/data")
)

// Configure scope names (optional)
featureName = "bank-assistant"
productName = "my-bank"
organizationName = "my-company"
}
}

Example usage within an agent node:

val rememberUserPreference by node {
withMemory {
// Save a fact about user preference
agentMemory.save(
fact = SingleFact(
concept = Concept("preferred-language", "User's preferred programming language"),
value = "Kotlin"
),
subject = MemorySubjects.User,
scope = MemoryScope.Product("my-ide")
)
}
}

Properties

Link copied to clipboard
open override val key: AIAgentStorageKey<AgentMemory>

Functions

Link copied to clipboard

Creates the initial configuration for the AgentMemory feature.

Link copied to clipboard
open override fun install(config: AgentMemory.Config, pipeline: AIAgentPipeline)

Installs the AgentMemory feature in an agent.

Link copied to clipboard
open fun installUnsafe(config: Any?, pipeline: AIAgentPipeline)