Hey did the memory implementation changed on the 0...
# koog-agentic-framework
s
Hey did the memory implementation changed on the 0.5.0? I don't see that facts are loaded on the prompt maybe I'm missing something
a
Hi, I don’t recall any major changes. It would be helpful if you can share a relevant code snippet
s
Hey sorry for the late answer. Here's the code snippet I used as an example. I attached two traces, one with 0.4.1 and the other with 0.5.0. As you can see on the screenshot taken with 0.5.0 the facts are not loaded
Copy code
suspend fun main() {
    // Memory configuration
    val localMemory = LocalFileMemoryProvider(
        config = LocalMemoryConfig("user-traits-memory"),
        storage = SimpleStorage(JVMFileSystemProvider.ReadWrite),
        fs = JVMFileSystemProvider.ReadWrite,
        root = Path("examples/kotlin/facts-store-kotlin/memory")
    ).also {
        runBlocking {
            it.save(
                fact = SingleFact(
                    concept = Concept(
                        "personality-trait",
                        "A personality trait of every user",
                        factType = FactType.SINGLE
                    ),
                    value = "Has no sense of humour, if they ask for a joke they expect an interesting fact instead",
                    timestamp = DefaultTimeProvider.getCurrentTimestamp()
                ),
                subject = MemorySubject.Everything,
                scope = MemoryScope.Agent("fact-agent"),
            )
        }
    }

    val strategy = strategy("fact-agent", toolSelectionStrategy = ToolSelectionStrategy.NONE) {

        val loadAll by nodeLoadAllFactsFromMemory<String>(
            name = "loadMemoryNode",
            subjects = listOf(MemorySubject.Everything)
        )

        val messageNode by node<String, String>("messageNode") {
            llm.writeSession {
                updatePrompt {
                    user(it)
                }
                requestLLMWithoutTools().content
            }
        }

        edge(nodeStart forwardTo loadAll)
        edge(loadAll forwardTo messageNode)
        edge(messageNode forwardTo nodeFinish)
    }

    // populate the openAI API key here.
    val agent = AIAgent(
        promptExecutor = simpleOpenAIExecutor(API_KEY),
        strategy = strategy,
        agentConfig = AIAgentConfig(
            prompt = prompt("fact-agent") {},
            model = OpenAIModels.Chat.GPT5Nano,
            maxAgentIterations = 10
        ),
        toolRegistry = ToolRegistry.EMPTY
    ) {
        install(AgentMemory) {
            memoryProvider = localMemory
        }
        install(OpenTelemetry) {
            addLangfuseExporter(
                langfuseUrl = "<http://localhost:33333>",
                langfusePublicKey = PUBLIC_KEY,
                langfuseSecretKey = PRIVATE_KEY,
            )
            setVerbose(true)
        }
    }

    agent.run("Tell me an interesting joke")
}
a
🙌 1
s
thanks!