Open
Description
i am build a mulit agent system use supervison schema with nodejs api.
first i try use webworker and call webworker.terminate, it's working as my expect. but for some data transfer problem, use worker seems not good.
so i try to use stream, and in for loop call stream.cancel. it ok, but not clean and crisp compare to worker.terminate.
root supervisor
let last_chunk
const stream = await compiledSuperGraph.stream({ messages }, config)
for await (const chunk of stream) {
if(!use_get_sender_loading()){
stream.cancel()
}
last_chunk = chunk
}
//////////////////////////////////////////////////////////
middle supervisor
let last_chunk
const stream = await target_management_graph.stream({ messages:state.instructions }, {streamMode:"values"})
for await (const chunk of stream) {
if(!use_get_sender_loading()){
stream.cancel()
}
last_chunk = chunk
}
is there any better way to do?
Metadata
Metadata
Assignees
Labels
No labels