MCPcopy
hub / github.com/zai-org/Open-AutoGLM / run

Method run

phone_agent/agent.py:84–110  ·  view source on GitHub ↗

Run the agent to complete a task. Args: task: Natural language description of the task. Returns: Final message from the agent.

(self, task: str)

Source from the content-addressed store, hash-verified

82 self._step_count = 0
83
84 def run(self, task: str) -> str:
85 """
86 Run the agent to complete a task.
87
88 Args:
89 task: Natural language description of the task.
90
91 Returns:
92 Final message from the agent.
93 """
94 self._context = []
95 self._step_count = 0
96
97 # First step with user prompt
98 result = self._execute_step(task, is_first=True)
99
100 if result.finished:
101 return result.message or "Task completed"
102
103 # Continue until finished or max steps reached
104 while self._step_count < self.agent_config.max_steps:
105 result = self._execute_step(is_first=False)
106
107 if result.finished:
108 return result.message or "Task completed"
109
110 return "Max steps reached"
111
112 def step(self, task: str | None = None) -> StepResult:
113 """

Callers 15

mainFunction · 0.95
example_basic_taskFunction · 0.95
example_with_callbacksFunction · 0.95
example_multiple_tasksFunction · 0.95
example_remote_deviceFunction · 0.95
mainFunction · 0.95
_send_keyeventMethod · 0.45
_run_hdc_commandFunction · 0.45
list_devicesMethod · 0.45
_get_device_detailsMethod · 0.45

Calls 1

_execute_stepMethod · 0.95

Tested by

no test coverage detected