Multi-agent supervisor #406

Closed
opened 2026-02-20 17:39:58 -05:00 by yindo · 1 comment
Owner

Originally created by @jason571 on GitHub (Jan 18, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

I add agent, run shell 
class Router(TypedDict):
    """Worker to route to next. If no workers needed, route to FINISH."""
    next: Literal["researcher", "coder", "shell", "FINISH"]

    def supervisor_node(self, state: State) -> Command[Literal["researcher", "coder", "shell", "__end__"]]:
        messages = [
                       {"role": "system", "content": self.system_prompt},
                   ] + state["messages"]
        response = self.llm.with_structured_output(Router).invoke(messages)
        goto = response["next"]
        if goto == "FINISH":
            goto = END

        mylogging.vip(response)
        return Command(goto=goto, update={"next": goto})

Question: check  Memory Usage
TASK can't FINISH, it keeps executing the shell, I've checked response = self.llm.invoke(messages)
response is FINISH. 
but self.llm.with_structured_output(Router).invoke(messages) response  is {'next': 'shell'}, this is bug.


Agent: [2025-01-18 14:04:30,491]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:30,498]-VIP-[supervisorProcess.py:97]: shell->supervisor
Starting tool: shell_tool with inputs: {'command': 'free -m'}
[2025-01-18 14:04:31,890]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1075       31085           3         298       30988
Swap:           8192           0        8192


Done tool: shell_tool
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1075 MB
- Free memory: 31085 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30988 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:35,914]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:35,940]-VIP-[supervisorProcess.py:97]: shell->supervisor
Starting tool: shell_tool with inputs: {'command': 'free -m'}
[2025-01-18 14:04:37,599]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1077       31083           3         298       30986
Swap:           8192           0        8192


Done tool: shell_tool
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1077 MB
- Free memory: 31083 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30986 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:40,450]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:40,504]-VIP-[supervisorProcess.py:97]: shell->supervisor
[2025-01-18 14:04:41,771]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1079       31081           3         298       30985
Swap:           8192           0        8192


Starting tool: shell_tool with inputs: {'command': 'free -m'}
Done tool: shell_tool
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1079 MB
- Free memory: 31081 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30985 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:44,322]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:44,500]-VIP-[supervisorProcess.py:97]: shell->supervisor
Starting tool: shell_tool with inputs: {'command': 'free -m'}
[2025-01-18 14:04:45,320]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1079       31081           3         298       30984
Swap:           8192           0        8192


Done tool: shell_tool
[2025-01-18 14:04:45,845]-INFO-[_base_client.py:1087]: Retrying request to /chat/completions in 0.483649 seconds
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1079 MB
- Free memory: 31081 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30984 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:49,860]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:50,079]-VIP-[supervisorProcess.py:97]: shell->supervisor
[2025-01-18 14:04:50,978]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1080       31080           3         298       30983
Swap:           8192           0        8192

Error Message and Stack Trace (if applicable)

[2025-01-18 14:04:35,940]-VIP-[supervisorProcess.py:97]: shell->supervisor
Starting tool: shell_tool with inputs: {'command': 'free -m'}
[2025-01-18 14:04:37,599]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1077       31083           3         298       30986
Swap:           8192           0        8192


Done tool: shell_tool
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1077 MB
- Free memory: 31083 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30986 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:40,450]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:40,504]-VIP-[supervisorProcess.py:97]: shell->supervisor
[2025-01-18 14:04:41,771]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1079       31081           3         298       30985
Swap:           8192           0        8192


Starting tool: shell_tool with inputs: {'command': 'free -m'}
Done tool: shell_tool
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1079 MB
- Free memory: 31081 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30985 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:44,322]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:44,500]-VIP-[supervisorProcess.py:97]: shell->supervisor
Starting tool: shell_tool with inputs: {'command': 'free -m'}
[2025-01-18 14:04:45,320]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1079       31081           3         298       30984
Swap:           8192           0        8192


Done tool: shell_tool
[2025-01-18 14:04:45,845]-INFO-[_base_client.py:1087]: Retrying request to /chat/completions in 0.483649 seconds
The memory usage is as follows:
- Total memory: 32064 MB
- Used memory: 1079 MB
- Free memory: 31081 MB
- Shared memory: 3 MB
- Buffer/cache memory: 298 MB
- Available memory: 30984 MB

The swap memory usage is as follows:
- Total swap: 8192 MB
- Used swap: 0 MB
- Free swap: 8192 MB[2025-01-18 14:04:49,860]-VIP-[agentSupervisor.py:41]: {'next': 'shell'}
[2025-01-18 14:04:50,079]-VIP-[supervisorProcess.py:97]: shell->supervisor
[2025-01-18 14:04:50,978]-INFO-[tools.py:24]: executing shell output:               total        used        free      shared  buff/cache   available
Mem:           32064        1080       31080           3         298       30983
Swap:           8192           0        8192

Description

Question: check Memory Usage
TASK can't FINISH, it keeps executing the shell, I've checked response = self.llm.invoke(messages)
response is FINISH.

System Info

I add agent, run shell
class Router(TypedDict):
"""Worker to route to next. If no workers needed, route to FINISH."""
next: Literal["researcher", "coder", "shell", "FINISH"]

def supervisor_node(self, state: State) -> Command[Literal["researcher", "coder", "shell", "__end__"]]:
    messages = [
                   {"role": "system", "content": self.system_prompt},
               ] + state["messages"]
    response = self.llm.with_structured_output(Router).invoke(messages)
    goto = response["next"]
    if goto == "FINISH":
        goto = END

    mylogging.vip(response)
    return Command(goto=goto, update={"next": goto})

Question: check Memory Usage
TASK can't FINISH, it keeps executing the shell, I've checked response = self.llm.invoke(messages)
response is FINISH.
but self.llm.with_structured_output(Router).invoke(messages) response is {'next': 'shell'}, this is bug.

Originally created by @jason571 on GitHub (Jan 18, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python I add agent, run shell class Router(TypedDict): """Worker to route to next. If no workers needed, route to FINISH.""" next: Literal["researcher", "coder", "shell", "FINISH"] def supervisor_node(self, state: State) -> Command[Literal["researcher", "coder", "shell", "__end__"]]: messages = [ {"role": "system", "content": self.system_prompt}, ] + state["messages"] response = self.llm.with_structured_output(Router).invoke(messages) goto = response["next"] if goto == "FINISH": goto = END mylogging.vip(response) return Command(goto=goto, update={"next": goto}) Question: check Memory Usage TASK can't FINISH, it keeps executing the shell, I've checked response = self.llm.invoke(messages) response is FINISH. but self.llm.with_structured_output(Router).invoke(messages) response is {'next': 'shell'}, this is bug. Agent: [2025-01-18 14:04:30,491]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:30,498]-VIP-[supervisorProcess.py:97]: shell->supervisor Starting tool: shell_tool with inputs: {'command': 'free -m'} [2025-01-18 14:04:31,890]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1075 31085 3 298 30988 Swap: 8192 0 8192 Done tool: shell_tool The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1075 MB - Free memory: 31085 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30988 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:35,914]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:35,940]-VIP-[supervisorProcess.py:97]: shell->supervisor Starting tool: shell_tool with inputs: {'command': 'free -m'} [2025-01-18 14:04:37,599]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1077 31083 3 298 30986 Swap: 8192 0 8192 Done tool: shell_tool The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1077 MB - Free memory: 31083 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30986 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:40,450]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:40,504]-VIP-[supervisorProcess.py:97]: shell->supervisor [2025-01-18 14:04:41,771]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1079 31081 3 298 30985 Swap: 8192 0 8192 Starting tool: shell_tool with inputs: {'command': 'free -m'} Done tool: shell_tool The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1079 MB - Free memory: 31081 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30985 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:44,322]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:44,500]-VIP-[supervisorProcess.py:97]: shell->supervisor Starting tool: shell_tool with inputs: {'command': 'free -m'} [2025-01-18 14:04:45,320]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1079 31081 3 298 30984 Swap: 8192 0 8192 Done tool: shell_tool [2025-01-18 14:04:45,845]-INFO-[_base_client.py:1087]: Retrying request to /chat/completions in 0.483649 seconds The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1079 MB - Free memory: 31081 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30984 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:49,860]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:50,079]-VIP-[supervisorProcess.py:97]: shell->supervisor [2025-01-18 14:04:50,978]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1080 31080 3 298 30983 Swap: 8192 0 8192 ``` ### Error Message and Stack Trace (if applicable) ```shell [2025-01-18 14:04:35,940]-VIP-[supervisorProcess.py:97]: shell->supervisor Starting tool: shell_tool with inputs: {'command': 'free -m'} [2025-01-18 14:04:37,599]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1077 31083 3 298 30986 Swap: 8192 0 8192 Done tool: shell_tool The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1077 MB - Free memory: 31083 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30986 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:40,450]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:40,504]-VIP-[supervisorProcess.py:97]: shell->supervisor [2025-01-18 14:04:41,771]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1079 31081 3 298 30985 Swap: 8192 0 8192 Starting tool: shell_tool with inputs: {'command': 'free -m'} Done tool: shell_tool The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1079 MB - Free memory: 31081 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30985 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:44,322]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:44,500]-VIP-[supervisorProcess.py:97]: shell->supervisor Starting tool: shell_tool with inputs: {'command': 'free -m'} [2025-01-18 14:04:45,320]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1079 31081 3 298 30984 Swap: 8192 0 8192 Done tool: shell_tool [2025-01-18 14:04:45,845]-INFO-[_base_client.py:1087]: Retrying request to /chat/completions in 0.483649 seconds The memory usage is as follows: - Total memory: 32064 MB - Used memory: 1079 MB - Free memory: 31081 MB - Shared memory: 3 MB - Buffer/cache memory: 298 MB - Available memory: 30984 MB The swap memory usage is as follows: - Total swap: 8192 MB - Used swap: 0 MB - Free swap: 8192 MB[2025-01-18 14:04:49,860]-VIP-[agentSupervisor.py:41]: {'next': 'shell'} [2025-01-18 14:04:50,079]-VIP-[supervisorProcess.py:97]: shell->supervisor [2025-01-18 14:04:50,978]-INFO-[tools.py:24]: executing shell output: total used free shared buff/cache available Mem: 32064 1080 31080 3 298 30983 Swap: 8192 0 8192 ``` ### Description Question: check Memory Usage TASK can't FINISH, it keeps executing the shell, I've checked response = self.llm.invoke(messages) response is FINISH. ### System Info I add agent, run shell class Router(TypedDict): """Worker to route to next. If no workers needed, route to FINISH.""" next: Literal["researcher", "coder", "shell", "FINISH"] def supervisor_node(self, state: State) -> Command[Literal["researcher", "coder", "shell", "__end__"]]: messages = [ {"role": "system", "content": self.system_prompt}, ] + state["messages"] response = self.llm.with_structured_output(Router).invoke(messages) goto = response["next"] if goto == "FINISH": goto = END mylogging.vip(response) return Command(goto=goto, update={"next": goto}) Question: check Memory Usage TASK can't FINISH, it keeps executing the shell, I've checked response = self.llm.invoke(messages) response is FINISH. but self.llm.with_structured_output(Router).invoke(messages) response is {'next': 'shell'}, this is bug.
yindo added the invalid label 2026-02-20 17:39:58 -05:00
yindo closed this issue 2026-02-20 17:39:58 -05:00
Author
Owner

@vbarda commented on GitHub (Jan 20, 2025):

Please provide https://stackoverflow.com/help/minimal-reproducible-example

@vbarda commented on GitHub (Jan 20, 2025): Please provide https://stackoverflow.com/help/minimal-reproducible-example
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#406