Best Practices
How to get the most out of Stagehand
Prompting Tips
Prompting Stagehand is more literal and atomic than other higher level frameworks, including agentic frameworks. Here are some guidelines to help you craft effective prompts:
Do
Use act()
as a fallback when Playwright fails
Use specific and concise actions
Break down complex tasks into smaller, atomic steps
Instead of combining actions:
Split them into individual steps:
Use observe()
to get actionable suggestions from the current page
Don’t
Use broad or ambiguous instructions
Combine multiple actions into one instruction
Expect Stagehand to perform high-level planning or reasoning
By following these guidelines, you’ll increase the reliability and effectiveness of your web automations with Stagehand. Remember, Stagehand excels at executing precise, well-defined actions so keeping your instructions atomic will lead to the best outcomes.
We leave the agentic behavior to higher-level agentic systems which can use Stagehand as a tool.