Update multi_agent.py
Browse files- multi_agent.py +28 -20
multi_agent.py
CHANGED
|
@@ -76,7 +76,7 @@ def run_multi_agent(llm, task):
|
|
| 76 |
llm_config=llm_config,
|
| 77 |
human_input_mode="ALWAYS",
|
| 78 |
)
|
| 79 |
-
|
| 80 |
planner = autogen.ConversableAgent(
|
| 81 |
name="Planner",
|
| 82 |
system_message="Given a task, please determine "
|
|
@@ -87,23 +87,35 @@ def run_multi_agent(llm, task):
|
|
| 87 |
"After each step is done by others, check the progress and "
|
| 88 |
"instruct the remaining steps. If a step fails, try to "
|
| 89 |
"workaround",
|
| 90 |
-
description="
|
| 91 |
"information is needed to complete the task. "
|
| 92 |
"After each step is done by others, check the progress and "
|
| 93 |
"instruct the remaining steps",
|
| 94 |
llm_config=llm_config,
|
| 95 |
)
|
| 96 |
-
|
| 97 |
engineer = autogen.AssistantAgent(
|
| 98 |
name="Engineer",
|
| 99 |
llm_config=llm_config,
|
| 100 |
-
description="
|
| 101 |
"provided by the planner.",
|
| 102 |
)
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
executor = autogen.ConversableAgent(
|
| 105 |
name="Executor",
|
| 106 |
-
|
| 107 |
"engineer and report the result.",
|
| 108 |
human_input_mode="NEVER",
|
| 109 |
code_execution_config={
|
|
@@ -113,28 +125,24 @@ def run_multi_agent(llm, task):
|
|
| 113 |
},
|
| 114 |
)
|
| 115 |
|
| 116 |
-
writer = autogen.ConversableAgent(
|
| 117 |
-
name="Writer",
|
| 118 |
-
llm_config=llm_config,
|
| 119 |
-
system_message="Writer."
|
| 120 |
-
"Please write blogs in markdown format (with relevant titles)"
|
| 121 |
-
" and put the content in pseudo ```md``` code block. "
|
| 122 |
-
"You take feedback from the admin and refine your blog.",
|
| 123 |
-
description="Writer."
|
| 124 |
-
"Write blogs based on the code execution results and take "
|
| 125 |
-
"feedback from the admin to refine the blog."
|
| 126 |
-
)
|
| 127 |
-
|
| 128 |
groupchat = autogen.GroupChat(
|
| 129 |
agents=[user_proxy, engineer, writer, executor, planner],
|
| 130 |
messages=[],
|
| 131 |
max_round=10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
)
|
| 133 |
-
|
| 134 |
manager = autogen.GroupChatManager(
|
| 135 |
groupchat=groupchat, llm_config=llm_config
|
| 136 |
)
|
| 137 |
-
|
| 138 |
groupchat_result = user_proxy.initiate_chat(
|
| 139 |
manager,
|
| 140 |
message=task,
|
|
|
|
| 76 |
llm_config=llm_config,
|
| 77 |
human_input_mode="ALWAYS",
|
| 78 |
)
|
| 79 |
+
|
| 80 |
planner = autogen.ConversableAgent(
|
| 81 |
name="Planner",
|
| 82 |
system_message="Given a task, please determine "
|
|
|
|
| 87 |
"After each step is done by others, check the progress and "
|
| 88 |
"instruct the remaining steps. If a step fails, try to "
|
| 89 |
"workaround",
|
| 90 |
+
description="Given a task, determine what "
|
| 91 |
"information is needed to complete the task. "
|
| 92 |
"After each step is done by others, check the progress and "
|
| 93 |
"instruct the remaining steps",
|
| 94 |
llm_config=llm_config,
|
| 95 |
)
|
| 96 |
+
|
| 97 |
engineer = autogen.AssistantAgent(
|
| 98 |
name="Engineer",
|
| 99 |
llm_config=llm_config,
|
| 100 |
+
description="Write code based on the plan "
|
| 101 |
"provided by the planner.",
|
| 102 |
)
|
| 103 |
+
|
| 104 |
+
writer = autogen.ConversableAgent(
|
| 105 |
+
name="Writer",
|
| 106 |
+
llm_config=llm_config,
|
| 107 |
+
system_message="Writer. "
|
| 108 |
+
"Please write blogs in markdown format (with relevant titles)"
|
| 109 |
+
" and put the content in pseudo ```md``` code block. "
|
| 110 |
+
"You take feedback from the admin and refine your blog.",
|
| 111 |
+
description="After all the info is available, "
|
| 112 |
+
"write blogs based on the code execution results and take "
|
| 113 |
+
"feedback from the admin to refine the blog. ",
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
executor = autogen.ConversableAgent(
|
| 117 |
name="Executor",
|
| 118 |
+
description="Execute the code written by the "
|
| 119 |
"engineer and report the result.",
|
| 120 |
human_input_mode="NEVER",
|
| 121 |
code_execution_config={
|
|
|
|
| 125 |
},
|
| 126 |
)
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
groupchat = autogen.GroupChat(
|
| 129 |
agents=[user_proxy, engineer, writer, executor, planner],
|
| 130 |
messages=[],
|
| 131 |
max_round=10,
|
| 132 |
+
allowed_or_disallowed_speaker_transitions={
|
| 133 |
+
user_proxy: [engineer, writer, executor, planner],
|
| 134 |
+
engineer: [user_proxy, executor],
|
| 135 |
+
writer: [user_proxy, planner],
|
| 136 |
+
executor: [user_proxy, engineer, planner],
|
| 137 |
+
planner: [user_proxy, engineer, writer],
|
| 138 |
+
},
|
| 139 |
+
speaker_transitions_type="allowed",
|
| 140 |
)
|
| 141 |
+
|
| 142 |
manager = autogen.GroupChatManager(
|
| 143 |
groupchat=groupchat, llm_config=llm_config
|
| 144 |
)
|
| 145 |
+
|
| 146 |
groupchat_result = user_proxy.initiate_chat(
|
| 147 |
manager,
|
| 148 |
message=task,
|