|
22 | 22 |
|
23 | 23 |
|
24 | 24 | class MultiAgentByEnvPolicy(AgentPolicy): |
25 | | - _main_agent_prompt = """You are a main agent, and your goal is to plan and give |
26 | | - instructions to sub-agents in each environment to complete the final task. Now you have |
27 | | - to do a task as described below: {task_description}. |
28 | | - The description of each given environment: {env_description}. |
29 | | - For each step, you are required to provide high-level instructions detailing the next |
30 | | - actions to be taken. Additionally, you must specify which sub-agent in the designated |
31 | | - environment should execute these instructions. If a sub-agent is not needed for a |
32 | | - particular step, you may instruct it to skip that step.""" |
| 25 | + _main_agent_prompt = """You are a main agent, and your goal is to plan and |
| 26 | + give instructions to sub-agents in each environment to complete the final task. Now |
| 27 | + you have to do a task as described below: {task_description}. The description of |
| 28 | + each given environment: {env_description}. For each step, you are required to |
| 29 | + provide high-level instructions detailing the next actions to be taken. |
| 30 | + Additionally, you must specify which sub-agent in the designated environment should |
| 31 | + execute these instructions. If a sub-agent is not needed for a particular step, you |
| 32 | + may instruct it to skip that step.""" |
33 | 33 |
|
34 | | - _env_agent_prompt = """You are a sub-agent responsible for the {environment} environment. |
35 | | - The description of the {environment} environment is: {env_description}. |
36 | | - Your goal is to assist the main agent in completing the final task by performing actions |
37 | | - in the {environment} environment according to the instructions from the main agent. The |
38 | | - final task is described below: {task_description}. A unit operation you can perform is called |
39 | | - action in a given environment. You can only execute action in the {environment} |
40 | | - environment. For the {environment} environment, you are given a limited action space as |
41 | | - function calls: |
| 34 | + _env_agent_prompt = """You are a sub-agent responsible for the {environment} |
| 35 | + environment. The description of the {environment} environment is: |
| 36 | + {env_description}. Your goal is to assist the main agent in completing the final |
| 37 | + task by performing actions in the {environment} environment according to the |
| 38 | + instructions from the main agent. The final task is described below: |
| 39 | + {task_description}. A unit operation you can perform is called action in a given |
| 40 | + environment. You can only execute action in the {environment} environment. For the |
| 41 | + {environment} environment, you are given a limited action space as function calls: |
42 | 42 | {action_descriptions} |
43 | 43 | The interactive UI elements on the screenshot are labeled with numeric tags starting |
44 | | - from 1. For each step, You will receive an instruction telling you what you need to do |
45 | | - next. After analyzing the instruction you received and the current {environment} system, |
46 | | - if you think you don't need to do anything in the current {environment} system, you should |
47 | | - choose SKIP action. Otherwise, you must state what actions to take, what the parameters |
48 | | - are, and you MUST provide in which environment to perform these actions. Your answer |
49 | | - must be function calls. Please do not output any other information. You must make sure |
50 | | - all function calls get their required parameters.""" |
| 44 | + from 1. For each step, You will receive an instruction telling you what you need to |
| 45 | + do next. After analyzing the instruction you received and the current {environment} |
| 46 | + system, if you think you don't need to do anything in the current {environment} |
| 47 | + system, you should choose SKIP action. Otherwise, you must state what actions to |
| 48 | + take, what the parameters are, and you MUST provide in which environment to perform |
| 49 | + these actions. Your answer must be function calls. Please do not output any other |
| 50 | + information. You must make sure all function calls get their required parameters.""" |
51 | 51 |
|
52 | 52 | _root_agent_prompt = """You are a sub-agent responsible for the crab benchmark root |
53 | 53 | environment. Your goal is to assist the main agent in completing the whole task: |
54 | | - "{task_description}". You can only complete the task or submit the result when the main |
55 | | - agent tells you the whole task has been completed. Otherwise, you can only call SKIP. |
56 | | - """ |
| 54 | + "{task_description}". You can only complete the task or submit the result when the |
| 55 | + main agent tells you the whole task has been completed. Otherwise, you can only call |
| 56 | + SKIP. """ |
57 | 57 |
|
58 | 58 | def __init__( |
59 | 59 | self, |
@@ -119,7 +119,10 @@ def chat( |
119 | 119 | main_prompt.extend(observation[env]) |
120 | 120 | main_prompt.append( |
121 | 121 | ( |
122 | | - f"Your target: {self.task_description}\nTell me the next step in each environment.", |
| 122 | + ( |
| 123 | + f"Your target: {self.task_description}\n" |
| 124 | + "Tell me the next step in each environment." |
| 125 | + ), |
123 | 126 | MessageType.TEXT, |
124 | 127 | ) |
125 | 128 | ) |
|
0 commit comments