You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the task asks to COUNT items (e.g., "how many listings", "number of results", "count the products", "total number of entries"):
350
+
- Use SCROLL_AND_COUNT instead of EXTRACT
351
+
- Set "countTarget" to describe what to count (e.g., "listings", "products", "articles")
352
+
- The system will scroll through the entire page and sum up counts
353
+
- Do NOT use EXTRACT for counting tasks — EXTRACT only sees the current viewport
354
+
355
+
Example - count all listings:
356
+
Goal: "note how many listings are available"
357
+
Current URL: alibaba.com/search?SearchText=smartphones (correct page)
358
+
{"action":"SCROLL_AND_COUNT","countTarget":"product listings","goal":"Count total product listings","verify":[]}
359
+
`
360
+
: '';
361
+
336
362
return`
337
363
338
364
IMPORTANT: Extraction Task Planning Rules
339
-
========================================
365
+
=======================================
340
366
341
367
STEP 1 - CHECK CURRENT URL:
342
368
Before choosing an action, compare the Current URL to the goal.
343
369
- Does the current page contain the data requested?
344
370
- If the goal mentions a specific section/page (e.g., "show hn", "top stories", "/show"), check if the URL matches.
345
-
- If you are NOT on the right page, NAVIGATE to the correct URL first.
371
+
- If you are NOT on the right page, NAVIGATE or CLICK to navigate to the correct page first.
346
372
347
373
STEP 2 - EXTRACT VISIBLE DATA:
348
374
If the data is VISIBLE in the page context:
@@ -352,7 +378,7 @@ If the data is VISIBLE in the page context:
352
378
CRITICAL: Do NOT click on links to external sites when extracting.
353
379
- Post/article titles often link to EXTERNAL sites
354
380
- To extract a title that is visible, use EXTRACT directly on the current page
355
-
- Only click if you need to navigate to a detail page (e.g., for comments)
381
+
- Only click if you need to navigate to a detail page to access the data (e.g., nutritional info on a recipe page)
356
382
357
383
Example - wrong page, need to navigate first:
358
384
Goal: "extract the title of the first showhn post on hackernews show"
@@ -369,18 +395,12 @@ Goal: "find the price of the first laptop"
369
395
Current URL: store.com/laptops (correct page, prices visible)
370
396
{"action":"EXTRACT","target":"price of first laptop","goal":"Extract the price of the first laptop listing","verify":[],"reasoning":"prices are visible in listing elements"}
371
397
372
-
STEP 3 - COUNTING ACROSS FULL PAGE:
373
-
If the task asks to COUNT items ("how many", "number of", "count", "total"):
374
-
- Use SCROLL_AND_COUNT instead of EXTRACT
375
-
- Set "countTarget" to describe what to count (e.g., "listings", "products", "articles")
376
-
- The system will scroll through the entire page and sum up counts
377
-
- Do NOT use EXTRACT for counting tasks — EXTRACT only sees the current viewport
378
-
379
-
Example - count all listings:
380
-
Goal: "note how many listings are available"
381
-
Current URL: alibaba.com/search?SearchText=smartphones (correct page)
382
-
{"action":"SCROLL_AND_COUNT","countTarget":"product listings","goal":"Count total product listings","verify":[]}
383
-
`;
398
+
Example - data on a detail page, need to click first:
399
+
Goal: "summarize the calorie count from a recipe's nutritional information"
400
+
Current URL: allrecipes.com/search?q=cookies (search results, not a recipe page)
401
+
{"action":"CLICK","intent":"first recipe link","input":"Best Chocolate Chip Cookies","verify":[],"reasoning":"need to navigate to recipe detail page for nutritional info"}
- TYPE: Type text into a SINGLE form field. Prefer FILL_FORM for forms with multiple fields.
64
68
- TYPE_AND_SUBMIT: Type text into a search box and submit. Set "input" to the SEARCH QUERY from the goal (NOT the element label).
65
69
- SCROLL: Scroll page. Set "direction" to "up" or "down".
66
-
- SCROLL_AND_COUNT: Scroll through the ENTIRE page and count items. Use when the task asks "how many", "number of", "count", or "total". Set "countTarget" to describe what to count (e.g., "listings", "products", "articles"). The system scrolls viewport-by-viewport, counts matching items at each position, and sums the total.
70
+
- SCROLL_AND_COUNT: Scroll through the ENTIRE page and count items. Use ONLY when the task asks to enumerate items (e.g., "how many listings", "number of results", "count the products"). Do NOT use when "count" is a data value to read (e.g., "calorie count", "word count" = use EXTRACT instead). Set "countTarget" to describe what to count.
67
71
- WAIT: Wait for content to appear when a follow-up verification is needed.
68
72
- EXTRACT: Extract the requested information from the current page when the task is data collection.
69
73
- STUCK: Use only when the page state is blocked and you cannot make safe forward progress.
@@ -124,7 +128,9 @@ RULES:
124
128
14. Treat history results "success", "skipped", and "vision_fallback" as already satisfied. Do not repeat those steps; choose the next incomplete part of the goal.`;
125
129
126
130
// Inject extraction-specific guidance when the goal is an extraction task
0 commit comments