Open guapia233 opened 2 months ago
You can add additional prompt to your react_agent
by using state_modifier
. So, if you set state_modifier
as a string then it will be converted into SystemMessage
and will be added to the beginning of the messages list. Same would happen if you pass a SystemMessage
on your own.
For more you can refer the documentation here
This is what I understood by your comment:
What you are facing is: your execution get stuck in the first agent and never goes to the second even though the agent 1's task is completed. If this is correct then I'd suggest to first setup LangSmith (if not done yet), it's extremely simple and straight forward.
prev
key in your state which stores which node/agent has been already called and pass it to the supervisor.react_agent
betterLet me know if this helps, cheers.
@py-taha I've already use langsimth before, and have done the first two points. Therefore, I will modify codes from the last two points you suggested:add prompts and maintain a prev key. I really appreciate the advice, it was exactly what I needed!
@py-taha I've already use langsimth before, and have done the first two points. Therefore, I will modify codes from the last two points you suggested:add prompts and maintain a prev key. I really appreciate the advice, it was exactly what I needed!
I appreciate it. Let me know if that doesn't work, I'd be happy to help even further.
Issue with current documentation:
hierarchical_agent_teams.ipynb link:https://github.com/langchain-ai/langgraph/blob/main/docs/docs/tutorials/multi_agent/hierarchical_agent_teams.ipynb
Idea or request for content:
I had been working on this example code for a long time in the field of penetration testing (although it was constantly being changed by the authorities) and started to notice a problem. For example, now there is a scan team consisting of a supervisor and two agents, each equipped with a tool. A team is given a task to be completed in two steps, which requires the cooperation of two agents to complete step by step, but often the task will be stuck in the cycle of the first agent, even if the first part of the task has been completed, and many times the team will not realize the existence of the second tool during the execution (the definition is correct, a separate test can succeed). I would like to know how this is caused and how it can be improved. In the example code, only the supervisor has prompts.How would you add a prompt to each agent, perhaps to solve this problem? I would be grateful if you could answer!