Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-agent supervisor #3096

Open
4 tasks done
jason571 opened this issue Jan 18, 2025 · 1 comment
Open
4 tasks done

Multi-agent supervisor #3096

jason571 opened this issue Jan 18, 2025 · 1 comment
Labels
invalid This doesn't seem right

Comments

@jason571
Copy link

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.

@vbarda
Copy link
Collaborator

vbarda commented Jan 20, 2025

@vbarda vbarda added the invalid This doesn't seem right label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants