claude-codeplaywrightagents

Claude Code + Playwright Hybrid Cuts Runtime 80%

Pure-Playwright agents pay browser cost on every step. The hybrid pattern with Scavio MCP cuts runtime 60-80% on typical research agents.

5 min read

An r/ClaudeAI post shared a ready-to-use Claude Code + Playwright repo for browsing websites. Pure-Playwright agents work but pay browser-time cost on every step, including the 70-90% of steps that just need indexed-target retrieval. The hybrid pattern (Scavio MCP for indexed targets, Playwright for interactive flows) cuts runtime 60-80% on typical research agents.

The cost split

A 50-step research agent on pure Playwright typically takes 5-8 minutes and costs $0.40-0.80 in browser time on Browserbase or similar. The same agent on Scavio for 40 indexed-target steps and Playwright for 10 interactive steps takes 1-2 minutes and costs roughly $0.10 total. Same output; 5x cost reduction; 4-5x runtime reduction.

The skill prompt that does the routing

Claude Code skills are markdown. The routing logic is a few lines of natural language. Done well, Claude picks the right tool 90%+ of the time on ambiguous prompts.

# tool-routing.md

For SERP, Reddit threads, YouTube videos, Amazon listings, Walmart
listings, and public articles: use Scavio MCP tools (search,
reddit_search, youtube_search, amazon_search, walmart_search, extract).

For auth-gated dashboards (Salesforce, internal SaaS, account-only
data) or JS-only SPAs that require interaction: use Playwright tools
(navigate, click, fill_form).

If a target is publicly indexed, prefer Scavio. Only escalate to
Playwright when Scavio cannot answer the query.

The MCP attach

Bash
claude mcp add scavio https://mcp.scavio.dev/mcp \
  --header "x-api-key: $SCAVIO_API_KEY"

# Playwright stays a separate tool — direct or via custom MCP wrap.

What kills the hybrid pattern

Builds where every target is auth-gated or JS-only: pure Playwright wins, the Scavio attach adds nothing. Builds where every target is indexed: pure Scavio wins, Playwright is unused. The hybrid is the right pattern when the agent has a mix, which is most research and prospecting agents.

The honest tradeoff

Routing is the variable. A poorly-prompted skill picks Playwright when Scavio would have answered, paying the browser cost unnecessarily. Tighten the prompt: "Only use Playwright when Scavio cannot answer. Try Scavio first." Verify by reviewing tool-call logs after 10-20 runs.

The repo pattern

The r/ClaudeAI repo is structured as a Claude Code skill with Playwright as the primary tool. Adding the hybrid is a small change: attach Scavio MCP, update the skill prompt to route, re-run. Build time: 30-60 minutes for an existing Playwright-first project.

Token implications

Scavio extract returns markdown directly, so the agent never feeds 30K-token raw HTML into the LLM context. On a 50-step task with ~10 page reads, that is the difference between roughly 300K input tokens (raw HTML) and 30K input tokens (markdown). At Sonnet 4.6 input rates, that is ~$0.81 vs ~$0.08 in token cost.

Cost math at scale

An agent running 100 research tasks per day pure-Playwright: ~$80/day in browser time + ~$80/day in token cost = ~$160/day = ~$5K/mo. Same volume on the hybrid: ~$10/day in browser + ~$8/day in tokens + ~$5/day in Scavio = ~$23/day = ~$700/mo. 7x cost reduction at scale.

Why this is the dominant 2026 pattern

Pure-Playwright agents shipped in 2024-2025 because hosted browsers (Browserbase, Anchor) made the infrastructure easy. Hosted MCP search APIs (Scavio) made the alternative easy in 2026. Production agents that ship in 2026 are mostly hybrids because the cost math is lopsided.