mdepies
07/07/2025, 1:28 PMPavel Gorgulov
07/07/2025, 1:41 PMrequestLLMStreaming
(according to the docs)
in that case, you’ll just get the string back as it comesmdepies
07/07/2025, 1:51 PMmdepies
07/07/2025, 2:19 PMmdepies
07/07/2025, 2:35 PMPavel Gorgulov
07/07/2025, 4:07 PMBook
instances will be created. So no, it’s not necessary to wait until the agent finishes its work.
Also, is the documentation detailing usage for an upcoming version? I see code examples that simply don't compile in .21No, the documentation should match the current published version. Could you let us know which specific examples aren’t working?
how to make use of streaming while using the agent strategy dsl. It seems like the output is locked to a full string response?What do you mean by that?
Finn Jensen
07/07/2025, 4:23 PMrunAndGetResult
in a Flow
then pass the emit function from the flow as an input to the strategy. So that the nodes can emit anything they need to the flow. Then you can collect that flow and emit server sent events or whatever you are doing to send to the user.
Here is a minimal example of a node that will emit the partial responses and also collect the full response as the output from the node.
fun AIAgentSubgraphBuilderBase<*, *>.streamPartial(emit: suspend (delta: String) -> Unit): AIAgentNodeDelegateBase<String, String> {
return node<String, String>("streamPartial") {
val responseStream = llm.writeSession {
requestLLMStreaming()
}
var finalMessage = ""
responseStream.collect { partial ->
emit(partial)
finalMessage += partial
}
finalMessage
}
}
mdepies
07/07/2025, 4:29 PMAndrey Bragin
07/09/2025, 8:47 PMAlso, is the documentation detailing usage for an upcoming version? I see code examples that simply don’t compile in .21Hi, make sure you’re looking at
main
branch, which corresponds to the latest release. Default branch is develop
, so some things here might be different from the latest released version.Andrey Bragin
07/09/2025, 8:53 PMprocessResponses
is just some dummy function that only streams the whole response and sends acknowledgement to the agent, but in the real world it can be some other component of your application.Andrey Bragin
07/09/2025, 8:55 PM