Find suggested actions for your workflows
observe()
?observe
allows you to turn any page into a checklist of reliable, executable actions. It discovers key elements, ranks likely next steps, and returns structured actions (selector, method, args) you can run instantly with act
or use to precisely target extract
so workflows are faster, cheaper, and more resilient.
observe()
?observe()
observe
supercharges other Stagehand methods. Use it to plan workflows, speed up act
, and precisely target extract
. Using observe
helps you explore what’s possible on a page by giving you a list of suggested actions.
act
to avoid extra LLM inference.
observe
suggestions will minimize the number of LLM calls for multi-step actions and speed up your workflow 2-3x.observe
to preview a batch of actions. For example, when filling a form you could ask observe
to find all the fields and then pass them in to act
. Call the LLM once, act multiple times.
observe
to focus extract
on a specific section of the page (like a table, a form, a list…) minimizes the context needed for an extraction.
extract
to reduce LLM token usage by 10x for verbose websites!observe
when a yes/no answer will gate an action (e.g., “Find the Submit button”), then conditionally act
.extract
for information-only questions (e.g., “What’s the page title?”, “How many results are listed?”).observe
: Use observe("Find…")
to map actionable elements and preview next steps.extract
with selectors from observe
: First observe("Find the data table")
, then pass selector
to extract
to reduce tokens and boost accuracy.ObserveResult
to act
(e.g., await page.act(results[0])
) to save LLM tokens. Batch operations by using observe
once to find elements, then act on each. Cache and reuse stable observe
results for familiar pages, using self-healing if layouts change.
iframes: true
and wait for networkidle
. Use observe
selectors in extract
to limit context.
method
, selector
, and arguments
to prevent misclicks. If a direct act
fails, use observe
with the same prompt to verify the method, then proceed with the suggested action.
No elements found
observe
returns empty arraySolutions:Inaccurate element descriptions
Wrong method identified