Step-by-step execution example (for debugging) / 单步执行示例(用于调试)
(lang: str = "cn")
| 71 | |
| 72 | |
| 73 | def example_step_by_step(lang: str = "cn"): |
| 74 | """Step-by-step execution example (for debugging) / 单步执行示例(用于调试)""" |
| 75 | msgs = get_messages(lang) |
| 76 | |
| 77 | agent_config = AgentConfig(lang=lang) |
| 78 | agent = PhoneAgent(agent_config=agent_config) |
| 79 | |
| 80 | # Initialize task |
| 81 | result = agent.step("打开美团搜索附近的火锅店") |
| 82 | print(f"{msgs['step']} 1: {result.action}") |
| 83 | |
| 84 | # Continue if not finished |
| 85 | while not result.finished and agent.step_count < 10: |
| 86 | result = agent.step() |
| 87 | print(f"{msgs['step']} {agent.step_count}: {result.action}") |
| 88 | print(f" {msgs['thinking']}: {result.thinking[:100]}...") |
| 89 | |
| 90 | print(f"\n{msgs['final_result']}: {result.message}") |
| 91 | |
| 92 | |
| 93 | def example_multiple_tasks(lang: str = "cn"): |
nothing calls this directly
no test coverage detected