Execution
The instantiated plans will be executed by a execute
task. In this phase, given the task-action data, the execution process will match the real controller based on word environment and execute the plan step by step. After execution, evalution
agent will evaluation the quality of the entire execution process.
ExecuteFlow
The ExecuteFlow
class is designed to facilitate the execution and evaluation of tasks in a Windows application environment. It provides functionality to interact with the application's UI, execute predefined tasks, capture screenshots, and evaluate the results of the execution. The class also handles logging and error management for the tasks.
Task Execution
The task execution in the ExecuteFlow
class follows a structured sequence to ensure accurate and traceable task performance:
-
Initialization:
-
Load configuration settings and log paths.
- Find the application window matching the task.
- Retrieve or create an
ExecuteAgent
for executing the task. -
Plan Execution:
-
Loop through each step in the
instantiated_plan
. - Parse the step to extract information like subtasks, control text, and the required operation.
-
Action Execution:
-
Find the control in the application window that matches the specified control text.
- If no matching control is found, raise an error.
- Perform the specified action (e.g., click, input text) using the agent's Puppeteer framework.
- Capture screenshots of the application window and selected controls for logging and debugging.
-
Result Logging:
-
Log details of the step execution, including control information, performed action, and results.
-
Finalization:
-
Save the final state of the application window.
- Quit the application client gracefully.
Evaluation
The evaluation process in the ExecuteFlow
class is designed to assess the performance of the executed task based on predefined prompts:
-
Start Evaluation:
-
Evaluation begins immediately after task execution.
- It uses an
ExecuteEvalAgent
initialized during class construction. -
Perform Evaluation:
-
The
ExecuteEvalAgent
evaluates the task using a combination of input prompts (e.g., main prompt and API prompt) and logs generated during task execution. - The evaluation process outputs a result summary (e.g., quality flag, comments, and task type).
-
Log and Output Results:
-
Display the evaluation results in the console.
- Return the evaluation summary alongside the executed plan for further analysis or reporting.
Reference
ExecuteFlow
Bases: AppAgentProcessor
ExecuteFlow class for executing the task and saving the result.
Initialize the execute flow for a task.
Parameters: |
|
---|
Source code in execution/workflow/execute_flow.py
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 |
|
execute(request, instantiated_plan)
Execute the execute flow: Execute the task and save the result.
Parameters: |
|
---|
Returns: |
|
---|
Source code in execution/workflow/execute_flow.py
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 |
|
execute_action()
Execute the action.
Source code in execution/workflow/execute_flow.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
execute_plan(instantiated_plan)
Get the executed result from the execute agent.
Parameters: |
|
---|
Returns: |
|
---|
Source code in execution/workflow/execute_flow.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
general_error_handler()
Handle general errors.
Source code in execution/workflow/execute_flow.py
374 375 376 377 378 379 |
|
init_and_final_capture_screenshot()
Capture the screenshot.
Source code in execution/workflow/execute_flow.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
log_save()
Log the constructed prompt message for the PrefillAgent.
Source code in execution/workflow/execute_flow.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
print_step_info()
Print the step information.
Source code in execution/workflow/execute_flow.py
233 234 235 236 237 238 239 240 241 242 243 244 |
|
process()
Process the current step.
Source code in execution/workflow/execute_flow.py
221 222 223 224 225 226 227 228 229 230 231 |
|
ExecuteAgent
Bases: AppAgent
The Agent for task execution.
Initialize the ExecuteAgent.
Parameters: |
|
---|
Source code in execution/agent/execute_agent.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
ExecuteEvalAgent
Bases: EvaluationAgent
The Agent for task execution evaluation.
Initialize the ExecuteEvalAgent.
Parameters: |
|
---|
Source code in execution/agent/execute_eval_agent.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
get_prompter(is_visual, prompt_template, example_prompt_template, api_prompt_template, root_name=None)
Get the prompter for the agent.
Parameters: |
|
---|
Returns: |
|
---|
Source code in execution/agent/execute_eval_agent.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|