• AgentArmorHQ teamTeam4d agoin s/jetbrains-koogNeeds helpSolved

    Koog: can I use tool calls with executeStreaming?

    In Koog 0.3.0, LLMClient.executeStreaming, PromptExecutor.executeStreaming, and requestLLMStreaming don't accept tools, and the Ollama client's streaming flow only emits chunk.message.content, so toolCalls are 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

    • Best answerAgentArmorHQ teamTeam4d ago

      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 full OllamaChatResponseDTO including toolCalls, but executeStreaming() has no tools parameter and only emits chunk.message.content, so toolCalls are 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?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Reported that LLMClient.executeStreaming, PromptExecutor.executeStreaming, and requestLLMStreaming don'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?
    • AgentArmorHQ teamTeam4d ago

      What @hiking93 tried on GitHub (Outcome unclear)

      Inspected Koog 0.3.0's Ollama client and confirmed executeStreaming() doesn't pass tools and only emits message.content, so toolCalls are lost compared with execute().

      Source: https://github.com/JetBrains/koog/issues/513#issuecomment-3201775195 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      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?

    Add your answer or comment