microsoft / autogen

A programming framework for agentic AI. Discord: https://aka.ms/autogen-dc. Roadmap: https://aka.ms/autogen-roadmap
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
28.36k stars 4.15k forks source link

Autogen Studio GroupChatWorkflow not working on pyautogen==0.2.13 but (working on pyautogen=0.2.10) #1693

Open akhilesh-chander opened 4 months ago

akhilesh-chander commented 4 months ago

Describe the bug

broken old feature. working on pyautogen=0.2.10

Steps to reproduce

Seems fails on function def _prepare_and_select_agents


        is_last_speaker_in_group = last_speaker in self.agents

        # this condition means last_speaker is a sink in the graph, then no agents are eligible
        if last_speaker not in self.allowed_speaker_transitions_dict and is_last_speaker_in_group:
            raise NoEligibleSpeakerException(
                f"Last speaker {last_speaker.name} is not in the allowed_speaker_transitions_dict."
            )```

### Expected Behavior

using autogenstudio ui
Sample Workflow: Travel Agent Group Chat Workflow
Chatl: Plan two day trip to Delhi

on pyautogen          0.2.13:
<No response>

on pyautogen          0.2.10 -- which is working fine
Based on the suggestions from the local_assistant and language_assistant, here is the final two-day trip plan to Delhi:
Day 1:
1. Start your day by visiting the iconic Red Fort. Explore the historical site and learn about its significance in Indian history.
2. Afterward, head to Jama Masjid, one of the largest mosques in India. Take a moment to admire the stunning architecture and peaceful atmosphere.
3. Next, visit Raj Ghat, the memorial site of Mahatma Gandhi. Pay your respects and learn about the life and teachings of the Father

### Screenshots and logs

_No response_

### Additional Information

_No response_
victordibia commented 4 months ago

HI @akhilesh-chander ,

Thanks for the note. What version of autogenstudio do you have?

sidhujag commented 4 months ago

It doesn't work on the latest autogenstudio, I also had the issue.

sidhujag commented 4 months ago
Screen Shot 2024-02-15 at 3 17 19 PM

This is what I see when running the travel workflow which is based on group chat,

It is related to https://github.com/microsoft/autogen/blob/main/samples/apps/autogen-studio/autogenstudio/workflowmanager.py#L41 because that is not the way to add new agents to group chat, there is additonal state in the post_init of the groupchat that needs to setup for agents in the group for speaker selection.

victordibia commented 4 months ago

Is this related to #1580 or a different error? Note current version of workflowmanager

sidhujag commented 4 months ago

Yup same, note the fix is probably something like this if you want to add the sender to the receiver group:

        # given the config, return an AutoGen agent object
        self.sender = self.load(config.sender, config.session_id)

        # given the config, return an AutoGen agent object
        if config.receiver.type == "groupchat":
            config.receiver.groupchat_config.agents.append(config.sender)
        self.receiver = self.load(config.receiver, config.session_id)
victordibia commented 4 months ago

What is your version of autogenstudio? i.e what version do you see when you run pip show autogenstudio. As far as I know, the issue in #1580 (GroupChat not initiating) is fixed in v0.0.44a. @sidhujag Can you confirm if you are still seeing that issue in v0.0.44a?

sidhujag commented 4 months ago

What is your version of autogenstudio? i.e what version do you see when you run pip show autogenstudio. As far as I know, the issue in #1580 (GroupChat not initiating) is fixed in v0.0.44a. @sidhujag Can you confirm if you are still seeing that issue in v0.0.44a?

Yup it looks better just testing i see some new bugs but not sure if its my fork of changes or official so I will play some more and report.

gagb commented 4 months ago

@victordibia is this related to this issue: https://github.com/microsoft/autogen/issues/1423

hurrytospring commented 4 months ago

groupchat append a new agent, but not rebuild it's allowed_speaker_transitions_dict. so it always raise error in groupchat.

https://github.com/microsoft/autogen/blob/09a491892151b2adef9025d741b6e7c26f877fcf/samples/apps/autogen-studio/autogenstudio/workflowmanager.py#L41

https://github.com/microsoft/autogen/blob/09a491892151b2adef9025d741b6e7c26f877fcf/autogen/agentchat/groupchat.py#L346

victordibia commented 4 months ago

@hurrytospring , please use the dev branch - https://github.com/microsoft/autogen/tree/autogenstudio

https://github.com/microsoft/autogen/blob/autogenstudio/samples/apps/autogen-studio/autogenstudio/workflowmanager.py

Does the issue still apply?

hurrytospring commented 4 months ago

@hurrytospring , please use the dev branch - https://github.com/microsoft/autogen/tree/autogenstudio

https://github.com/microsoft/autogen/blob/autogenstudio/samples/apps/autogen-studio/autogenstudio/workflowmanager.py

Does the issue still apply?

it did work,thanks