langgraph/tutorials/multi_agent/agent_supervisor/ #683
Replies: 18 comments 19 replies
-
Question: Why are we passing 2 system messages? Or are we not? prompt = ChatPromptTemplate.from_messages( |
Beta Was this translation helpful? Give feedback.
-
Is there any simple implementation for |
Beta Was this translation helpful? Give feedback.
-
How is the agent invoked with state without providing specific keys? |
Beta Was this translation helpful? Give feedback.
-
Can someone please tell me how/where is the supervisor giving the relevant prompt to the agents? Like who is telling the agent what to do? |
Beta Was this translation helpful? Give feedback.
-
laughing in "escreva um relatório sobre pikas" |
Beta Was this translation helpful? Give feedback.
-
In the following, create_agent mentions about "agent_scratchpad" but i can't find it mentioned anywhere in the subsequent code. Can someone help me understand how it works? Is it necessary? def create_agent(llm: ChatOpenAI, tools: list, system_prompt: str): |
Beta Was this translation helpful? Give feedback.
-
I had a problem executing the Python code portion of this. Changing this code helped me: This executes code locally, which can be unsafe#python_repl_tool = PythonREPLTool() from langchain_experimental.utilities import PythonREPL
|
Beta Was this translation helpful? Give feedback.
-
Could this example please be updated to not use the legacy create_openai_tools_agent() and AgentExecutor(). |
Beta Was this translation helpful? Give feedback.
-
For those of you here using AzureChatOpenAI - Otherwise, you'll run into this on any complex query that triggers your supervisory agent to call >1 sub-agent in parallel
Anyone with a solution to disable this, or better, handle parallel tool calls, would be excellent. Otherwise, the only alternative is to rearchitect the overall workflow in such a way that it can't call more than 1 tool at a time. |
Beta Was this translation helpful? Give feedback.
-
I'm using Lamma 3 with openai and I have a custom base_url. I have single agents with tools running fine (with create_sql_agents). the problem: thanks! |
Beta Was this translation helpful? Give feedback.
-
Could you provide an example to show the supervisor can manage two agents all together? The current examples only shows that supervisor can invoke one of them but not prove they can collaborate together. Thanks! |
Beta Was this translation helpful? Give feedback.
-
In router-chain building, |
Beta Was this translation helpful? Give feedback.
-
it seems that the code was updated, and now the supervisor_chain is wrapped in a function def:
I guess the node definition should also be udpated? |
Beta Was this translation helpful? Give feedback.
-
At least for me, in this code |
Beta Was this translation helpful? Give feedback.
-
I downloaded this file and try with Ollama with below code. # llm = ChatOpenAI(
# api_key="ollama",
# model="llama3.1",
# base_url="http://localhost:11434/v1",
# )
from langchain_ollama import ChatOllama
llm = ChatOllama(model='llama3.1') Then I got below error. File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/utils/runnable.py:159, in RunnableCallable.invoke(self, input, config, **kwargs)
157 context = copy_context()
158 context.run(_set_config_context, child_config)
--> 159 ret = context.run(self.func, input, **kwargs)
160 except BaseException as e:
161 run_manager.on_chain_error(e)
Cell In[5], line 8, in <lambda>(x)
6 conditional_map = {k: k for k in members}
7 conditional_map["FINISH"] = END
----> 8 workflow.add_conditional_edges("supervisor", lambda x: x["next"], conditional_map)
9 # Finally, add entrypoint
10 workflow.add_edge(START, "supervisor")
KeyError: 'next' How can I fix this? Full log--------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[15], line 1 ----> 1 for s in graph.stream( 2 { 3 "messages": [ 4 HumanMessage(content="Code hello world and print it to the terminal") 5 ] 6 } 7 ): 8 if "__end__" not in s: 9 print(s)File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/pregel/init.py:1278, in Pregel.stream(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug, subgraphs) File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/pregel/runner.py:52, in PregelRunner.tick(self, tasks, reraise, timeout, retry_policy, get_waiter) File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/pregel/retry.py:29, in run_with_retry(task, retry_policy) File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/utils/runnable.py:387, in RunnableSeq.invoke(self, input, config, **kwargs) File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/utils/runnable.py:167, in RunnableCallable.invoke(self, input, config, **kwargs) File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/graph/graph.py:94, in Branch._route(self, input, config, reader, writer) File ~/miniconda3/envs/multi/lib/python3.11/site-packages/langgraph/utils/runnable.py:159, in RunnableCallable.invoke(self, input, config, **kwargs) Cell In[11], line 8, in (x) KeyError: 'next' |
Beta Was this translation helpful? Give feedback.
-
Were are the prompts for the other nodes? how do they know what is their purpose? |
Beta Was this translation helpful? Give feedback.
-
I am stuck in infinite loop in this section. is the following correct? I see two system in the same prompt prompt = ChatPromptTemplate.from_messages(
[
("system", system_prompt),
MessagesPlaceholder(variable_name="messages"),
(
"system",
"Given the conversation above, who should act next?"
" Or should we FINISH? Select one of: {options}",
),
]
).partial(options=str(options), members=", ".join(members)) I think it must be like this:
|
Beta Was this translation helpful? Give feedback.
-
How to add memory to Supervisor. I tried graph = workflow.compile(checkpointer=memory) but no work. |
Beta Was this translation helpful? Give feedback.
-
langgraph/tutorials/multi_agent/agent_supervisor/
Build language agents as graphs
https://langchain-ai.github.io/langgraph/tutorials/multi_agent/agent_supervisor/
Beta Was this translation helpful? Give feedback.
All reactions