| 237 | groupchat = GroupChat(agents=[navigator, editor, executor, planner], messages=[], max_round=20, speaker_selection_method=custom_speaker_selection_func) |
| 238 | |
| 239 | def stop_condition(msg): |
| 240 | if "Final Answer"in msg["content"]: |
| 241 | return True |
| 242 | elif all([agent_name not in msg["content"] for agent_name in ["Navigator", "Editor", "Executor"]]) and msg["name"] == "Planner": |
| 243 | return True |
| 244 | else: |
| 245 | return False |
| 246 | manager = GroupChatManager(name="hyperagent", groupchat=groupchat, llm_config={"config_list": llm_config["plan"]}, is_termination_msg=lambda msg: stop_condition(msg)) |
| 247 | return manager |