Browser library integration

Twin Browser + Playwright

Playwright is a browser automation library that drives Chromium, Firefox, and WebKit with explicit, imperative commands — click this selector, fill that field, assert this text. It is precise and fast, but every selector is hand-written and brittle to page changes.

Browser library3 MCP tools: run · compile_skill · run_skillBearer key auth

How Twin plugs into Playwright

Twin sits one level above Playwright-style scripting: instead of authoring and maintaining selectors, you hand Twin a goal and it compiles the DOM into a token-efficient indexed state, plans the actions, and executes them. The successful path is frozen into a skill that replays deterministically — the resilience of a recorded script without the brittleness of hand-keyed selectors, and without re-running the LLM each time. Use Playwright when you want full manual control; use Twin when you want a goal to become durable, replayable action.

Twin is the browser execution layer your stack calls. The first run cold-compiles a skill; every similar request after that is matched from the cache and replayed deterministically, so your marginal cost per run trends toward zero.

app.example.com
  1. Receive goal from Playwrightdone
  2. Compile DOM → token-efficient indexed statedone
  3. Match the semantic dispatch cacherunning
  4. Replay compiled skill — 0 LLM callsqueued
Wire it up

Drop Twin into Playwright

Copy, paste, and swap in your Bearer key. The first run compiles a skill; repeats hit the semantic dispatch cache and replay deterministically.

Playwright vs. Twin — same taskpython
# Playwright: explicit, brittle selectors you maintain by hand
page.goto("https://app.example.com/login")
page.fill("#email", user)
page.fill("#password", pw)
page.click("button[type=submit]")
page.click("text=Download invoice")

# Twin: a goal that compiles into a replayable skill
requests.post(
    "https://twin-browser.com/api/v1/run",
    headers={"Authorization": "Bearer tw_live_xxx"},
    json={"goal": "Log in and download the latest invoice",
          "url": "https://app.example.com/login"},
)  # compile once, then run_skill replays with zero LLM calls

Base URL https://twin-browser.com/api/v1 · auth Authorization: Bearer tw_live_… · MCP tools run, compile_skill, run_skill.

Get started

Connect Playwright in 4 steps

Install → configure your key → make the first call. The cache takes over from there.

  1. 1
    Pick the layer

    Decide where you want goals (Twin) vs. explicit selectors (Playwright).

  2. 2
    Send a goal

    POST the goal to /api/v1/run instead of scripting each step.

  3. 3
    Compile a skill

    Freeze the successful run so future executions skip the LLM.

  4. 4
    Replay deterministically

    Call run_skill for a fast, selector-free, LLM-free replay.

Why this stays cheap at scale

Most browser infrastructure re-runs the LLM on every execution, so cost climbs with usage. Twin compiles a task once via skill compilation, matches re-phrased requests to it, and replays without the model — so repeated workflows stop scaling with your token bill.

FAQ

Playwright on Twin — common questions

Is Twin built on Playwright?
Twin is a higher-level execution layer that can run over Playwright-class browser infrastructure. The difference is the skill layer — compile-once, semantic cache, deterministic replay — that raw Playwright does not provide.
When should I keep using Playwright directly?
When you want full, deterministic control over a small, stable set of selectors. Reach for Twin when tasks are varied, re-phrased, or change often, so the cost of writing and maintaining scripts dominates.

Wire up Playwright in minutes

Free to start. Usage-based credits from $29/mo, with LLM cost metered and passed through at 1×.