loadFactsToAgent

suspend fun loadFactsToAgent(concept: Concept, scopes: List<MemoryScopeType> = MemoryScopeType.entries, subjects: List<MemorySubject> = MemorySubject.registeredSubjects)(source)

Loads facts about a specific concept from memory and adds them to the LLM chat history.

This method retrieves facts about the specified concept from all requested scopes and subjects, then adds them to the agent's LLM context as user messages. This makes the information available to the LLM for subsequent interactions.

Facts are loaded with priority given to more specific subjects (lower priority level). For single facts with the same concept, only the most specific one is used.

Example usage:

// Load user preferences into the agent's context
memory.loadFactsToAgent(
concept = Concept("preferred-language", "User's preferred programming language"),
scopes = listOf(MemoryScopeType.PRODUCT, MemoryScopeType.AGENT),
subjects = listOf(MemorySubjects.User)
)

Parameters

concept

The concept to load facts about

scopes

List of memory scopes to search in (Agent, Feature, etc.). By default all scopes are used.

subjects

List of subjects to search in (User, Project, etc.). By default all registered subjects are used.