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

Function example_step_by_step

examples/basic_usage.py:73–90  ·  view source on GitHub ↗

Step-by-step execution example (for debugging) / 单步执行示例(用于调试)

(lang: str = "cn")

Source from the content-addressed store, hash-verified

71
72
73def 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
93def example_multiple_tasks(lang: str = "cn"):

Callers

nothing calls this directly

Calls 4

stepMethod · 0.95
get_messagesFunction · 0.90
AgentConfigClass · 0.90
PhoneAgentClass · 0.90

Tested by

no test coverage detected