Koog: can I use tool calls with executeStreaming?
In Koog 0.3.0,
LLMClient.executeStreaming,PromptExecutor.executeStreaming, andrequestLLMStreamingdon't accept tools, and the Ollama client's streaming flow only emitschunk.message.content, sotoolCallsare lost. Is there a supported way to stream responses when the LLM may decide to invoke a tool, instead of waiting synchronously for the full response?Originally asked on GitHub: https://github.com/JetBrains/koog/issues/513
4 answers
Status: explained — no built-in streaming tool-call API was added in this thread; the GitHub issue was closed (COMPLETED) and is tracked in JetBrains YouTrack (KG-206).
The workaround suggested by the maintainers is the MarkdownStreamingWithToolsExample (opens external site) in the Koog repository. The idea is to stream the response and parse the structured output on the fly — for example with kotlinx-serialization — and trigger tool calls as soon as partial data is available, instead of waiting for the entire tool call to finish. A maintainer explained that this lets you call tools incrementally and gives a more responsive UX. The reporter rejected this as not being LangChain-style "stream tool calls" where the LLM dynamically decides whether to invoke tools while streaming; a contributor replied that for that pattern you need to bring your own JSON streaming parser.
A commenter also confirmed the architectural reason behind the limitation: in Koog 0.3.0's Ollama client,
execute()parses the fullOllamaChatResponseDTOincludingtoolCalls, butexecuteStreaming()has notoolsparameter and only emitschunk.message.content, sotoolCallsare dropped.If you need full tool-call semantics, the options discussed in the thread are to use the non-streaming
execute()/requestLLM()when a tool call is possible, or to build a graph where one node streams output and another invokes tools after parsing; the reporter noted that the reActStrategy pattern cannot be trivially adapted to streaming. General advice: for UI progress, stream visible content first and show tool execution as a separate step.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reported that
LLMClient.executeStreaming,PromptExecutor.executeStreaming, andrequestLLMStreamingdon't support tool calls when building an agent with Koog.Source: https://github.com/JetBrains/koog/issues/513 (opens external site)
Did this work for you?What @hiking93 tried on GitHub (Outcome unclear)
Inspected Koog 0.3.0's Ollama client and confirmed
executeStreaming()doesn't passtoolsand only emitsmessage.content, sotoolCallsare lost compared withexecute().Source: https://github.com/JetBrains/koog/issues/513#issuecomment-3201775195 (opens external site)
Did this work for you?What @zarechneva-a tried on GitHub (Outcome unclear)
A contributor suggested the MarkdownStreamingWithToolsExample workaround: stream structured output and parse it incrementally to trigger tool calls. Not verified in the thread.
Source: https://github.com/JetBrains/koog/issues/513#issuecomment-3183196142 (opens external site)
Did this work for you?
Related questions
- Does koog support local LLMs on Android or iOS?
- Does koog support iOS targets in Kotlin Multiplatform projects?
- Does Koog support the A2A Protocol for multi-agent systems?
- koog executeStreaming() missing tools arg: tool calls dropped in streaming responses
- Koog crashes with NoSuchMethodError after kotlinx-datetime 0.7.1