MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / load_agent_executor

Function load_agent_executor

src/hyperagent/agents/plan_seeking.py:133–192  ·  view source on GitHub ↗
(
    llm_config,
    docker_executor,
    sys_prompt,
    summarizer
)

Source from the content-addressed store, hash-verified

131 return editor
132
133def load_agent_executor(
134 llm_config,
135 docker_executor,
136 sys_prompt,
137 summarizer
138):
139 terminate_condition = lambda x: x.get("content", "").find("Final Answer:") > 0
140 def response_preparer(self, messages):
141 plain_messages = [message["content"] for message in messages]
142 query = plain_messages[0].split("Query: ")[-1].strip()
143 analysis = ""
144 analysis = summarizer(f"Summarize the bash code execution for following {query} in the codebase, notes that give the key observations. Execution: {' '.join(plain_messages[1:-1])}")
145 analysis += plain_messages[-1].replace("Final Answer:", "")
146 return plain_messages[-1].replace("Final Answer:", "")
147
148 executor_assistant = AssistantAgent(
149 "Inner-Executor-Assistant",
150 system_message=sys_prompt,
151 llm_config={"config_list": llm_config},
152 human_input_mode="NEVER",
153 )
154
155 executor_interpreter = UserProxyAgent(
156 name="Executor Interpreter",
157 is_termination_msg=terminate_condition,
158 llm_config=False,
159 code_execution_config={
160 "executor": docker_executor,
161 },
162 human_input_mode="NEVER",
163 default_auto_reply="",
164 )
165
166 groupchat_exec = GroupChat(
167 agents=[executor_assistant, executor_interpreter],
168 messages=[],
169 speaker_selection_method="round_robin",
170 allow_repeat_speaker=False,
171 max_round=15,
172 )
173
174 manager_exec = GroupChatManager(
175 groupchat=groupchat_exec,
176 name="Executor Manager",
177 llm_config={"config_list": llm_config},
178 max_consecutive_auto_reply=0
179 )
180
181 executor = SocietyOfMindAgent(
182 "Executor",
183 chat_manager=manager_exec,
184 llm_config={"config_list": llm_config},
185 response_preparer=response_preparer
186 )
187
188 executor.register_hook(
189 "process_last_received_message",
190 lambda content: react_exec_prompt_message(content),

Callers 1

SetupFunction · 0.90

Calls 2

getMethod · 0.80

Tested by

no test coverage detected