AgentMemoryProvider

Core interface for managing an agent's persistent memory system. This interface defines the fundamental operations for storing and retrieving knowledge in a structured, context-aware manner.

Key features:

  • Structured knowledge storage using concepts and facts

  • Context-aware memory organization (subjects and scopes)

  • Flexible storage backend support (local/remote)

  • Semantic search capabilities

Usage example:

val provider: AgentMemoryProvider = LocalFileMemoryProvider(
config = LocalMemoryConfig("memory"),
storage = EncryptedStorage(fs, encryption),
fs = JVMFileSystemProvider,
root = basePath
)

// Store project information
provider.save(
fact = SingleFact(
concept = Concept("build-system", "Project build configuration", FactType.SINGLE),
timestamp = currentTime,
value = "Gradle 8.0"
),
subject = MemorySubject.Project,
scope = MemoryScope.Product("my-app")
)

// Retrieve environment information
val envFacts = provider.loadByDescription(
description = "system environment",
subject = MemorySubject.Machine,
scope = MemoryScope.Agent("env-analyzer")
)

Inheritors

Functions

Link copied to clipboard
abstract suspend fun load(concept: Concept, subject: MemorySubject, scope: MemoryScope): List<Fact>

Retrieves facts associated with a specific concept. This operation provides:

Link copied to clipboard
abstract suspend fun loadAll(subject: MemorySubject, scope: MemoryScope): List<Fact>

Retrieves all facts within a specific context. This operation is useful for:

Link copied to clipboard
abstract suspend fun loadByDescription(description: String, subject: MemorySubject, scope: MemoryScope): List<Fact>

Performs semantic search across stored facts. This operation enables:

Link copied to clipboard
abstract suspend fun save(fact: Fact, subject: MemorySubject, scope: MemoryScope)

Persists a fact in the agent's memory system. This operation ensures: