追随者智能体 🚶🏽♂️
FollowerAgent
继承自 AppAgent
,负责根据用户的指令在应用程序内执行特定任务。FollowerAgent
旨在根据用户的指导执行一系列动作。它对于软件测试特别有用,当提供明确的指令来验证应用程序的行为时。
与 AppAgent 的区别
FollowerAgent
与 AppAgent
共享大部分功能,但它的设计是为了遵循用户提供的分步指令,而不是自己推理以确定下一步动作。
用法
FollowerAgent
以 follower
模式可用。您可以在文档中找到更多详细信息。它还使用不同的 Session
和 Processor
来处理用户的指令。用户在 json 文件中提供分步指令,然后由 FollowerAgent
解析该文件以执行动作。json 文件示例如下所示
{
"task": "Type in a bold text of 'Test For Fun'",
"steps":
[
"1.type in 'Test For Fun'",
"2.select the text of 'Test For Fun'",
"3.click on the bold"
],
"object": "draft.docx"
}
参考
基类:AppAgent
FollowerAgent 类是 FollowedAgent 的管理器,它遵循分步指令在应用程序中执行动作。它是 AppAgent 的子类,AppAgent 完成应用程序中的动作执行。
初始化 FollowAgent。
参数 |
|
---|
源代码位于 agents/agent/follower_agent.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
get_prompter(is_visual, main_prompt, example_prompt, api_prompt, app_info_prompt, app_root_name='')
获取追随者智能体的提示器。
参数 |
|
---|
返回 |
|
---|
源代码位于 agents/agent/follower_agent.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
message_constructor(dynamic_examples, dynamic_knowledge, image_list, control_info, prev_subtask, plan, request, subtask, host_message, current_state, state_diff, blackboard_prompt, include_last_screenshot)
为 FollowAgent 构建提示消息。
参数 |
|
---|
返回 |
|
---|
源代码位于 agents/agent/follower_agent.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|