Skip to main content
Optimizing Skyvern tasks can reduce costs, improve reliability, and speed up execution. This guide covers best practices for performance and cost optimization.

Understanding costs

Skyvern costs are primarily driven by:
  1. LLM token usage — The largest cost factor
  2. Step count — More steps = more LLM calls
  3. Proxy usage — Residential proxies cost more than datacenter
  4. Browser time — Time spent with browser session active

Optimize token usage

Token usage is the biggest cost driver. Here’s how to reduce it:
Problem: Verbose prompts increase token costs on every step.Solution: Be specific but concise.
prompt="Fill name: John Smith, email: [email protected], select Express shipping, submit"
What it does: Skyvern can use a lighter, cheaper model for simple operations.Setup:
LLM_KEY=OPENAI_GPT4O  # Primary model for complex reasoning
SECONDARY_LLM_KEY=OPENAI_GPT4O_MINI  # Lighter model for simple tasks
Benefit: Can reduce costs by 50-80% for straightforward tasks.
Problem: max_screenshot_scrolls captures more content but increases tokens.Solution: Only use scrolling when necessary.
# Only scroll if content is known to be below the fold
result = await client.run_task(
    prompt="Find invoice #12345",
    url="https://example.com/invoices",
    max_screenshot_scrolls=3  # Only if needed
)
Default: 0 (no scrolling) Recommendation: Use 2-5 only when content requires scrolling
What it does: LLM providers cache repeated prompts to reduce costs.How it helps: If running similar tasks repeatedly, caching can reduce costs by 50-90%.Note: Available with certain LLM providers (Anthropic Claude, OpenAI GPT-4, etc.)

Optimize step count

Fewer steps = fewer LLM calls = lower costs and faster execution.
Problem: Multiple separate prompts for related actions.
prompt="Enter username '[email protected]', password 'secretPass123', and click Login"
Benefit: 1 step instead of 3+
Problem: AI doesn’t know when to stop, wasting steps.Solution: Be explicit about completion.
prompt="Fill out the form with provided data. COMPLETE when you see 'Form submitted successfully'"
Benefit: Prevents unnecessary verification steps.
Problem: Single task trying to do too much.Solution: Break into workflow blocks with clear boundaries.Example workflow:
  1. Block 1: Navigate to invoices page
  2. Block 2: Extract list of invoices (pass to next block)
  3. Block 3: Loop through invoices and download each
Benefit: Better control, easier debugging, clearer completion criteria.
Problem: Default max_steps may be too high or too low.Solution: Set based on task complexity.
# Simple form fill
max_steps=10

# Complex navigation + form
max_steps=30

# Multi-page workflow
max_steps=50
Benefit: Prevents wasted steps on tasks that should fail fast.

Optimize browser session time

Problem: Starting at homepage and navigating wastes steps.
url="https://example.com/account/invoices"  # Direct link
Benefit: Faster execution, fewer steps.
Problem: Logging in on every run wastes time and steps.Solution: Use browser profiles to persist login state.
result = await client.run_task(
    prompt="Download latest invoice",
    url="https://example.com/invoices",
    browser_profile_id="prof_123456"  # Already logged in
)
Benefit: Skip login steps entirely, faster execution, lower costs.
Problem: Creating new browser session for each task.Solution: Reuse browser session for multiple tasks.
browser = await client.launch_cloud_browser()
page = await browser.get_working_page()

# Task 1
await page.goto("https://example.com/page1")
await page.act("Extract data from this page")

# Task 2 - reuse same browser
await page.goto("https://example.com/page2")
await page.act("Extract data from this page")

await browser.close()
Benefit: Avoid browser startup overhead.

Optimize proxy usage

Cost comparison:
  • Datacenter proxy: Lower cost
  • Residential proxy: Higher cost
  • Residential ISP proxy: Highest cost
Recommendation:
  • Try without proxy first
  • Use datacenter proxy if blocked
  • Use RESIDENTIAL_ISP only if absolutely necessary (login issues, strict anti-bot)
Problem: Using international proxy for domestic site.Solution: Match proxy location to site’s target region.
# US-based site
proxy_location="RESIDENTIAL_US"

# UK-based site
proxy_location="RESIDENTIAL_UK"
Benefit: Better performance, less likely to be blocked.

Data extraction optimization

Problem: Open-ended extraction wastes tokens.
data_extraction_schema={
    "type": "object",
    "properties": {
        "invoice_number": {"type": "string"},
        "amount": {"type": "number"},
        "date": {"type": "string"}
    }
}
Benefit: Focused extraction, consistent output, fewer tokens.
Problem: Extracting unnecessary data.Solution: Only request fields you actually need.
# Only extract what you'll use
data_extraction_schema={
    "invoice_id": "string",
    "total": "number"
    # Don't extract: line items, addresses, etc. if not needed
}
Benefit: Less processing, smaller responses, lower costs.

Monitoring and measurement

Monitor these metrics to identify optimization opportunities:
  • Average step count per task type
  • Token usage per run
  • Task duration (start to completion)
  • Failure rate by task type
  • Cost per successful run
Action: Identify outliers and optimize those specific tasks.
What it shows: Detailed breakdown of each step.
timeline = await client.get_run_timeline(run_id)

for item in timeline:
    if item.type == "block":
        print(f"Block: {item.block.label}")
        print(f"Duration: {item.block.duration}s")
        print(f"Actions: {len(item.block.actions)}")
Use this to:
  • Identify which blocks take the most time
  • Find blocks with excessive steps
  • Optimize high-cost operations
Strategy: Test different prompt formulations.Example:
  • Version A: Detailed step-by-step instructions
  • Version B: Concise goal-oriented prompt
Measure:
  • Success rate
  • Average step count
  • Cost per run
Choose: The version that balances success rate and cost.

Cost reduction checklist

1

Audit current usage

Review your runs to understand current costs and identify high-cost tasks.
2

Optimize prompts

Make prompts concise, combine actions, add clear completion criteria.
3

Configure secondary LLM

Set up a lighter model for simple operations.
4

Use browser profiles

Persist login state to avoid repeated authentication.
5

Right-size max_steps

Set appropriate step limits based on task complexity.
6

Optimize proxy usage

Use cheaper proxies when possible, match location to site.
7

Monitor and iterate

Track metrics and continuously optimize based on data.

Performance benchmarks

Typical performance targets:
Task TypeStepsDurationCost (approx)
Simple form fill5-1030-60s$0.05-0.15
Login + navigation10-201-2 min$0.15-0.30
Data extraction15-302-3 min$0.30-0.60
Complex workflow30-503-5 min$0.60-1.20
Actual costs vary based on LLM provider, model, proxy usage, and task complexity.

Next steps

Error Handling

Implement robust error handling

Webhooks

Use webhooks instead of polling

Task Parameters

Optimize task configuration

Workflow Blocks

Build efficient workflows

Build docs developers (and LLMs) love