Skip to content

Commit 3332192

Browse files
author
Shriyansh Agnihotri
committed
improving prompts and javascript click skeptism
1 parent 13365ec commit 3332192

File tree

7 files changed

+17
-22
lines changed

7 files changed

+17
-22
lines changed

testzeus_hercules/core/agents/api_nav_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ class ApiNavAgent(BaseNavAgent):
7373
7474
- **Success:**
7575
previous_step: <previous step assigned>
76-
[DETAILED EXPANDED COMPLETE LOSS LESS output]
76+
current_output: [DETAILED EXPANDED COMPLETE LOSS LESS output]
7777
##FLAG::SAVE_IN_MEM##
7878
##TERMINATE TASK##
7979
8080
- **Information Request:**
8181
previous_step: <previous step assigned>
82-
[DETAILED EXPANDED COMPLETE LOSS LESS output]
82+
current_output: [DETAILED EXPANDED COMPLETE LOSS LESS output]
8383
##TERMINATE TASK##
8484
8585
- **Error:**
8686
previous_step: <previous step assigned>
87-
[Issue description]
87+
current_output: [Issue description]
8888
[Required information]
8989
##TERMINATE TASK##
9090

testzeus_hercules/core/agents/browser_nav_agent.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@ class BrowserNavAgent(BaseNavAgent):
6565
## Response Format
6666
### Success:
6767
previous_step: <previous step assigned>
68-
[Detailed description of actions performed and outcomes]
68+
current_output: [Detailed description of actions performed and outcomes]
6969
Data: [Specific values, counts, or details retrieved]
7070
##FLAG::SAVE_IN_MEM##
7171
##TERMINATE TASK##
7272
7373
### Information Request Response:
7474
previous_step: <previous step assigned>
75-
[Detailed answer with specific information extracted from the DOM]
75+
current_output: [Detailed answer with specific information extracted from the DOM]
7676
Data: [Relevant extracted information]
7777
##TERMINATE TASK##
7878
7979
### Error or Uncertainty:
8080
previous_step: <previous step assigned>
81-
[Precise description of the issue encountered]
81+
current_output: [Precise description of the issue encountered]
8282
[If contradictory signals are present, include specific details about the contradiction]
8383
##TERMINATE TASK##
8484
@@ -130,14 +130,8 @@ class BrowserNavAgent(BaseNavAgent):
130130
• If the page is not responding, try to close the modal/popup/dialog/notification/toast/alert/etc.
131131
132132
### VISUAL VALIDATION
133-
• Perform visual validation of UI elements when appropriate tools are available
134-
• Compare actual visual appearance against expected design specifications
135-
• Verify correct rendering of images, layouts, colors, and visual components
136-
• Detect visual anomalies such as overlapping elements, misalignment, or display errors
137-
• Validate responsive design across different viewport sizes when required
138-
• Report detailed visual discrepancies with specific coordinates and element descriptions
139-
• Use screenshot comparison tools to identify visual regressions
140-
• Validate accessibility features such as contrast ratios and text legibility
133+
• Perform visual validation of UI when appropriate tools are available
134+
• You have excellent tools to analyse the screen.
141135
142136
### TASK COMPLETION
143137
• Always complete ALL required steps before reporting success

testzeus_hercules/core/agents/high_level_planner_agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ class PlannerAgent:
223223
12. Include explicit closure nudges but let helpers decide implementation details
224224
13. Acknowledge platform context when mentioned by helpers with minimal nudges
225225
14. Always ensure next_step is a STRING, never an object or other data type
226+
15. IF LOGICALLY THE NEXT STEP IS NOT ACHIEVABLE, AFTER MULTIPLE ATTEMPTS, REPORT THE ISSUE AND TERMINATE with Failure.
227+
16. YOU CAN'T ASK TO DO ANYTHING MANUALLY, IN SUCH CASE REPORT THE ISSUE AND TERMINATE with Failure.
226228
227229
Available Test Data: $basic_test_information
228230
"""

testzeus_hercules/core/agents/sql_nav_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class SqlNavAgent(BaseNavAgent):
3939
## Response Format
4040
- Task completion:
4141
previous_step: <previous step assigned>
42-
Summary + ##FLAG::SAVE_IN_MEM## + ##TERMINATE TASK##
42+
current_output: Summary + ##FLAG::SAVE_IN_MEM## + ##TERMINATE TASK##
4343
- Failures:
4444
previous_step: <previous step assigned>
45-
Detailed explanation + ##TERMINATE TASK##
45+
current_output: Detailed explanation + ##TERMINATE TASK##
4646
4747
## Restrictions
4848
- No external knowledge use

testzeus_hercules/core/extra_tools/visual_skill.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@tool(
2727
agent_names=["browser_nav_agent"],
2828
name="compare_visual_screenshot",
29-
description="Compare the current browser view with a reference image or screenshot and log results",
29+
description="Compare the current screen view with a reference image or screenshot and return results",
3030
)
3131
async def compare_visual_screenshot(
3232
reference_image_path: Annotated[
@@ -185,7 +185,7 @@ def write_json(path: str, data: Dict) -> None:
185185
@tool(
186186
agent_names=["browser_nav_agent"],
187187
name="validate_visual_feature",
188-
description="Validate if specific features or items are present in the current browser view",
188+
description="Validate if specific features or items are present in the current screen",
189189
)
190190
async def validate_visual_feature(
191191
feature_description: Annotated[

testzeus_hercules/core/playwright_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,9 +1654,9 @@ async def perform_javascript_click(
16541654
if (ariaExpandedBeforeClick === 'false' && ariaExpandedAfterClick === 'true') {
16551655
return "Executed " + type_of_click + " on element with selector: " + selector +
16561656
". Very important: As a consequence, a menu has appeared where you may need to make further selection. " +
1657-
"Very important: Get all_fields DOM to complete the action.";
1657+
"Very important: Get all_fields DOM to complete the action." + " The click is best effort, so verify the outcome.";
16581658
}
1659-
return "Executed " + type_of_click + " on element with selector: " + selector;
1659+
return "Executed " + type_of_click + " on element with selector: " + selector + " The click is best effort, so verify the outcome.";
16601660
}"""
16611661

16621662
try:

testzeus_hercules/core/tools/click_using_selector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,9 @@ async def do_click(
312312
additional_data={"click_type": "javascript_fallback"},
313313
)
314314

315-
msg = f'Successfully clicked element with selector: "{selector}" using JavaScript fallback'
316315
return {
317316
"summary_message": msg,
318-
"detailed_message": f"{msg}. The standard click method failed, but JavaScript click succeeded.",
317+
"detailed_message": f"{msg}.",
319318
}
320319
except Exception as js_error:
321320

0 commit comments

Comments
 (0)