MCPcopy Create free account
hub / github.com/bytedance/trae-agent / _run_simple_interactive_loop

Function _run_simple_interactive_loop

trae_agent/cli.py:516–595  ·  view source on GitHub ↗

Run the interactive loop for simple console.

(
    agent: Agent,
    cli_console: CLIConsole,
    trae_agent_config: TraeAgentConfig,
    config_file: str,
    trajectory_file: str | None,
)

Source from the content-addressed store, hash-verified

514
515
516async def _run_simple_interactive_loop(
517 agent: Agent,
518 cli_console: CLIConsole,
519 trae_agent_config: TraeAgentConfig,
520 config_file: str,
521 trajectory_file: str | None,
522):
523 """Run the interactive loop for simple console."""
524 while True:
525 try:
526 task = cli_console.get_task_input()
527 if task is None:
528 console.print("[green]Goodbye![/green]")
529 break
530
531 if task.lower() == "help":
532 console.print(
533 Panel(
534 """[bold]Available Commands:[/bold]
535
536• Type any task description to execute it
537• 'status' - Show agent status
538• 'clear' - Clear the screen
539• 'exit' or 'quit' - End the session""",
540 title="Help",
541 border_style="yellow",
542 )
543 )
544 continue
545
546 working_dir = cli_console.get_working_dir_input()
547
548 if task.lower() == "status":
549 console.print(
550 Panel(
551 f"""[bold]Provider:[/bold] {agent.agent_config.model.model_provider.provider}
552 [bold]Model:[/bold] {agent.agent_config.model.model}
553 [bold]Available Tools:[/bold] {len(agent.agent.tools)}
554 [bold]Config File:[/bold] {config_file}
555 [bold]Working Directory:[/bold] {os.getcwd()}""",
556 title="Agent Status",
557 border_style="blue",
558 )
559 )
560 continue
561
562 if task.lower() == "clear":
563 console.clear()
564 continue
565
566 # Set up trajectory recording for this task
567 console.print(f"[blue]Trajectory will be saved to: {trajectory_file}[/blue]")
568
569 task_args = {
570 "project_path": working_dir,
571 "issue": task,
572 "must_patch": "false",
573 }

Callers 1

interactiveFunction · 0.85

Calls 5

get_task_inputMethod · 0.45
printMethod · 0.45
get_working_dir_inputMethod · 0.45
startMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected