When to Use AI vs Manual Automation
Use AI When:
- Dynamic UIs - Elements don’t have stable selectors or IDs
- Complex interactions - Multi-step workflows that are hard to script
- Natural workflows - Actions easier to describe than code
- Rapid prototyping - Quick proof-of-concept without precise selectors
- Handling variations - Page structure varies based on state or user
- Data extraction - Unstructured content needs to be parsed
Use Manual Automation When:
- Performance critical - AI adds 1-3 seconds per call
- High volume - Thousands of operations (cost adds up)
- Stable selectors - Elements have reliable IDs or classes
- Exact precision - Need pixel-perfect control
- Offline scenarios - No internet or API access
- Simple operations - Basic click/input on known elements
Decision Tree
Hybrid Approach (Recommended)
The most effective pattern combines both AI and manual automation:Prompt Engineering
Write Clear, Specific Instructions
Good prompts:Break Down Complex Tasks
Instead of one massive instruction:Provide Context
Help the AI understand the page structure:Error Handling Patterns
Graceful Fallbacks
Always have a backup plan:Retry with Different Instructions
If extraction fails, try rephrasing:Validation and Verification
Verify AI actions worked as expected:Cost Management
Optimize API Usage
AI calls cost money - use them wisely:Cache Extracted Data
Don’t extract the same data repeatedly:Use Cheaper Models for Simple Tasks
Batch Operations
Process multiple items with fewer AI calls:Testing and Reliability
Test Against Real Pages
Always test with actual websites:Handle Page Variations
Pages may look different based on state:Set Timeouts
AI operations can take time:Monitor Success Rates
Track how often AI automation succeeds:Schema Design
Start Simple, Then Expand
Begin with basic schemas and add complexity as needed:Use Appropriate Types
Match types to the actual data format:Make Fields Optional When Appropriate
Not all data is always present:Performance Optimization
Minimize Page Context
The AI analyzes page content - simpler pages = faster processing:Parallel Execution
Run independent operations in parallel:Pre-navigate and Cache
Navigate ahead of time:Security Considerations
Protect API Keys
Never expose API keys in code:Sanitize Instructions
If instructions come from user input, sanitize them:Review AI Actions in Development
Log actions during development to verify behavior:Complete Example
Here’s a complete example following all best practices:Related
Natural Language Actions
Learn about page.act()
Data Extraction
Learn about page.extract()
AI Setup
Configure AI agents
Page API Overview
Manual automation methods