MCPcopy Create free account
hub / github.com/HKUDS/AutoAgent / main

Function main

autoagent/cli.py:185–235  ·  view source on GitHub ↗

Run deep research with a given model, container name, port

(container_name: str, port: int, test_pull_name: str, git_clone: bool, local_env: bool)

Source from the content-addressed store, hash-verified

183@click.option('--git_clone', default=True, help='whether to clone a mirror of the repository')
184@click.option('--local_env', default=False, help='whether to use local environment')
185def main(container_name: str, port: int, test_pull_name: str, git_clone: bool, local_env: bool):
186 """
187 Run deep research with a given model, container name, port
188 """
189 model = COMPLETION_MODEL
190 print('\033[s\033[?25l', end='') # Save cursor position and hide cursor
191 with Progress(
192 SpinnerColumn(),
193 TextColumn("[progress.description]{task.description}"),
194 transient=True # 这会让进度条完成后消失
195 ) as progress:
196 task = progress.add_task("[cyan]Initializing...", total=None)
197
198 progress.update(task, description="[cyan]Initializing config...[/cyan]\n")
199 docker_config = get_config(container_name, port, test_pull_name, git_clone)
200
201 progress.update(task, description="[cyan]Setting up logger...[/cyan]\n")
202 log_path = osp.join("casestudy_results", 'logs', f'agent_{container_name}_{model}.log')
203 LoggerManager.set_logger(MetaChainLogger(log_path = None))
204
205 progress.update(task, description="[cyan]Creating environment...[/cyan]\n")
206 if local_env:
207 code_env, web_env, file_env = create_environment_local(docker_config)
208 else:
209 code_env, web_env, file_env = create_environment(docker_config)
210
211 progress.update(task, description="[cyan]Setting up autoagent...[/cyan]\n")
212
213 clear_screen()
214
215 context_variables = {"working_dir": docker_config.workplace_name, "code_env": code_env, "web_env": web_env, "file_env": file_env}
216
217 # select the mode
218 while True:
219 update_guidance(context_variables)
220 mode = single_select_menu(['user mode', 'agent editor', 'workflow editor', 'exit'], "Please select the mode:")
221 match mode:
222 case 'user mode':
223 clear_screen()
224 user_mode(model, context_variables, False)
225 case 'agent editor':
226 clear_screen()
227 meta_agent(model, context_variables, False)
228 case 'workflow editor':
229 clear_screen()
230 meta_workflow(model, context_variables, False)
231 case 'exit':
232 console = Console()
233 logo_text = Text(GOODBYE_LOGO, justify="center")
234 console.print(Panel(logo_text, style="bold salmon1", expand=True))
235 break
236
237
238def user_mode(model: str, context_variables: dict, debug: bool = True):

Callers

nothing calls this directly

Calls 11

MetaChainLoggerClass · 0.90
single_select_menuFunction · 0.90
meta_agentFunction · 0.90
meta_workflowFunction · 0.90
create_environment_localFunction · 0.85
clear_screenFunction · 0.85
update_guidanceFunction · 0.85
user_modeFunction · 0.85
set_loggerMethod · 0.80
get_configFunction · 0.70
create_environmentFunction · 0.70

Tested by

no test coverage detected