You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this is Yoo.
I've been used prebuilt.create_react_agent to make agents for making multi-agent system.
It's super cool but the thing happened when I tried to stream the output of agents. I used stream function with paramter stream_mode=messages to stream LLM tokens generated by model. And I checked that langgraph_node of chunk's metadata of all agents are the same as 'agent'. Below is the example of standard output of chunk -> metadata -> next chunk -> next metadata sequentially.
So I was not able to distinguish which chunk came from which agents. This is because the name of LLM calling node is hardcoded as 'agent' in the prebuilt.create_react_agent. Since there is name parameter in the create_react_agent function, it's for graph-level, not node-level. So what I did was modifying node name as given 'name' parameter temporarily in the function.
For my example, I wanted to only stream output of supevisor agent which is created by create_supervisor function from langgraph-supervisor which also uses create_react_agent internally.
Since I don't know langgraph that deeply, I wonder if there is some fancy way to handle this.
However, I still think that If this function could optionally receive parameters from the user and dynamically modify the LLM node name, it would make the distinction clearer and allow for more flexible handling of different situations. If this is considered to make sense, I really hope to make a PR for this, receive feedbacks, and contributes this amazing frameworks!!!😃
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, this is Yoo.
I've been used
prebuilt.create_react_agent
to make agents for making multi-agent system.It's super cool but the thing happened when I tried to stream the output of agents. I used stream function with paramter
stream_mode=messages
to stream LLM tokens generated by model. And I checked thatlanggraph_node
of chunk's metadata of all agents are the same as 'agent'. Below is the example of standard output of chunk -> metadata -> next chunk -> next metadata sequentially.So I was not able to distinguish which chunk came from which agents. This is because the name of LLM calling node is hardcoded as 'agent' in the
prebuilt.create_react_agent
. Since there isname
parameter in the create_react_agent function, it's for graph-level, not node-level. So what I did was modifying node name as given 'name' parameter temporarily in the function.For my example, I wanted to only stream output of supevisor agent which is created by
create_supervisor
function fromlanggraph-supervisor
which also usescreate_react_agent
internally.Since I don't know langgraph that deeply, I wonder if there is some fancy way to handle this.
However, I still think that If this function could optionally receive parameters from the user and dynamically modify the LLM node name, it would make the distinction clearer and allow for more flexible handling of different situations. If this is considered to make sense, I really hope to make a PR for this, receive feedbacks, and contributes this amazing frameworks!!!😃
I ask for maintainer's help.
Best Regards,
Beta Was this translation helpful? Give feedback.
All reactions