In my Spring service, I get an error when I try to...
# koog-agentic-framework
a
In my Spring service, I get an error when I try to call:
Copy code
val executor = simpleOllamaAIExecutor()
    val systemPrompt = "You are a helpful assistant. Answer user questions concisely."

    val model: LLModel = LLModel(
        provider = LLMProvider.OpenRouter,
        id = "deepseek-r1:7b",
        capabilities = listOf(LLMCapability.Schema.JSON.Simple)
    )

val agent: AIAgent = simpleSingleRunAgent(
    executor = executor,
    llmModel = model,
    systemPrompt = systemPrompt
)
Copy code
2025-05-24T09:39:55.893+02:00 ERROR 14781 --- [PhDGTnumGoData] [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Async processing failed: java.lang.NoSuchMethodError: 'kotlinx.coroutines.CoroutineDispatcher kotlinx.coroutines.CoroutineDispatcher.limitedParallelism$default(kotlinx.coroutines.CoroutineDispatcher, int, java.lang.String, int, java.lang.Object)'] with root cause

java.lang.NoSuchMethodError: 'kotlinx.coroutines.CoroutineDispatcher kotlinx.coroutines.CoroutineDispatcher.limitedParallelism$default(kotlinx.coroutines.CoroutineDispatcher, int, java.lang.String, int, java.lang.Object)'
	at ai.koog.agents.core.feature.AIAgentPipeline.<init>(AIAgentPipeline.kt:49) ~[agents-core-jvm-0.1.0.jar:0.1.0]
	at ai.koog.agents.core.agent.AIAgent.<init>(AIAgent.kt:104) ~[agents-core-jvm-0.1.0.jar:0.1.0]
	at ai.koog.agents.ext.agent.AIAgentExtKt.simpleSingleRunAgent(AIAgentExt.kt:87) ~[agents-ext-jvm-0.1.0.jar:0.1.0]
	at ai.koog.agents.ext.agent.AIAgentExtKt.simpleSingleRunAgent$default(AIAgentExt.kt:69) ~[agents-ext-jvm-0.1.0.jar:0.1.0]
	at fr.gtnum.imt.phdgtnumgodata.service.AIAgentService.hello$suspendImpl(AIAgentService.kt:25) ~[main/:na]
	at fr.gtnum.imt.phdgtnumgodata.service.AIAgentService.hello(AIAgentService.kt) ~[main/:na]
	at fr.gtnum.imt.phdgtnumgodata.controller.AIAgentController.hello$suspendImpl(AIAgentController.kt:27) ~[main/:na]
	at fr.gtnum.imt.phdgtnumgodata.controller.AIAgentController.hello(AIAgentController.kt) ~[main/:na]
d
You should put your code in the thread. 😊
Are you sure you have a recent
kotlinx-coroutines
version. One that has the
limitedParallelism
feature? It looks to me that you have either a classloader problem due to Spring or incorrect versions of Kotlin and Kotlinx libraries
a
Yes, I have the recent kotlinx-coroutines version
1.8.1
d
It looks like the method that is called takes a string, so I would guess it is the variant introduced in the 1.9.0 version. Have you tried bumping to the more recent 1.10.2 version?
Yep, looking at Koog's version catalog, you're definitely using way too old versions: https://github.com/JetBrains/koog/blob/develop/gradle/libs.versions.toml
a
I will check right now, thank you
thank you color 1
p
By the way, you might have a mistake here. You declare the Ollama executor, but you’re using the OpenRouter provider. I think you can use the proper
simpleOpenRouterExecutor
instead
a
I find it difficult to use a local model, from Ollama with "deepseek-r1:7b" model Is there any way to do it?
d
@Akram Bensalem you'd have to use develop. There were some APIs introduced to facilitate custom model use with OllamaClient. Disclaimer: those are subject to change.
👍 1