Skip to main content
Stagehand performance depends on several factors: DOM processing speed, LLM inference time, browser operations, and network latency. This guide provides proven strategies to maximize automation speed.

Quick Performance Wins

1. Plan Ahead with Observe

Use a single observe() call to plan multiple actions, then execute them efficiently:
Performance Tip: Acting on observe results avoids LLM inference entirely. This approach is 2-3x faster than direct act() calls and is the recommended pattern for multi-step workflows.

Caching Guide

Learn advanced caching patterns and cache invalidation strategies

2. Optimize DOM Processing

Reduce DOM complexity before Stagehand processes the page:

3. Set Appropriate Timeouts

Use shorter timeouts for simple operations and longer ones for complex page loads:

Performance Monitoring and Benchmarking

Track performance metrics and measure optimization impact:

Performance Tracking

Example Output:

Before vs After Benchmarking

Example Output:

Observability & Metrics

Set up comprehensive performance monitoring

Caching Strategies

Advanced caching patterns for maximum performance

Cost Optimization

Balance speed improvements with cost considerations

Browser Configuration

Optimize Browserbase settings for speed

Model Selection

Choose the right model for speed vs accuracy