Hello ! I'm thrilled about that Koog framework. So...
# koog-agentic-framework
c
Hello ! I'm thrilled about that Koog framework. So much potential and enjoyable to use. I've got a small question about the usage of memory. Let's say I create a memory and assign it to an agent like below:
Copy code
// Create a memory provider
    var memProvider = LocalFileMemoryProvider(
        config = LocalMemoryConfig("symfonic-memory"),
        storage = SimpleStorage(JVMFileSystemProvider.ReadWrite),
        fs = JVMFileSystemProvider.ReadWrite,
        root = Path("./memory/data")
    )
    memProvider.save(
        fact = SingleFact(
            concept = Concept(
                "Planning", "Model for planning processes",
                FactType.SINGLE
            ),
            timestamp = DefaultTimeProvider.getCurrentTimestamp(),
            value = "Planning Model1"
        ),
        subject = company1.TQModel,
        scope = MemoryScope.Agent("symfonicAgent")
    )

    val symfonicAgent = AIAgent(
        promptExecutor = executor,
        strategy = singleRunStrategy(),// this means oue agent will run only once and perfom its task
        agentConfig = agentConfig,
        toolRegistry = toolMCPRegistry,
    ) {
        install(AgentMemory) {
            memoryProvider = memProvider
            agentName = "symfonicAgent"
        }
    }
Is there a way I can retrieve the value "Planning Model1" in a conversation ? In the documentation, memory is used only with nodes. Is that the only way to use it? Thank you again for the great work !
v
Hi Chris! Thanks, happy to see you onboard! Indeed, memory in its current implementation is intended to be used programmatically in strategy: you can define when to save &load facts and what type of facts are relevant. Also you can opt for auto-detecting facts by LLM but still you have to define the places to save and load facts in your strategy. Please feel free to check the example here: https://github.com/JetBrains/koog/blob/develop/examples/simple-examples/src/main/kotlin/ai/koog/agents/example/memory/CustomerSupportAgent.kt
Could you please also share what was your expected behaviour of memory?
c
Thank you for your answers, Vadim. Your explanation is clear. I simply was trying to find a way to initialize some hard-coded data so that when discussing with the agent, whenever we mention the name of the fact, the agent can use the associated value for further data processing.
v
I see now, thanks for sharing your use case . It looks like you don’t really need the AgentMemory, you probably would need RAG or just including this information into the context: • if you don’t have too many facts - it might make sense to include them hard coded into the initial prompt of your agent • if you have a lot of facts (but they are known) you might consider https://docs.koog.ai/ranked-document-storage/ with https://docs.koog.ai/embeddings/ so that you can index a large set of facts and then provide some sort of relevance search across them (for example, as a fact-search tool available to your agent)
AgentMemory feature was designed for another use case — when you essentially don’t know the facts beforehand , and they are user/product/client dependent. So, an agent can accumulate this information throughout its execution, then perform the fact retrieval and then save them to some remote storage. So that the next time same user comes — we can reuse this specific personalised information
c
That's clear @Vadim Briliantov! I'll actually create the strategy to use that AgentMemory in that way and get the user's input. Also, as you mentioned Document Storage, I'm already using it and it works like a charm for now. I only had a hard time to combine that with an MCP server. And I finally found the syntax:
Copy code
// Create the SSE transport
val transport = McpToolRegistryProvider.defaultSseTransport("<http://localhost:3001/sse>")
// Create a tool registry with tools from the MCP server
val toolMCPRegistry = McpToolRegistryProvider.fromTransport(
    transport = transport,
    name = "mcpServer",
    version = "1.0.0"
)

toolMCPRegistry.add(::searchModules.asTool())
Thank you again.
kodee loving 1
119 Views