Skip to main content
Install the Playwright SDK and run a checkout where your code only ever handles mock tokens.

Overview

@agentvault/playwright is a drop-in for Playwright’s chromium. Every browser action runs in the Agent Vault proxy. Your agent fills forms with mock tokens, and the proxy substitutes the real card numbers, addresses and passwords inside its own browser.
Prefer no code at all? The MCP server exposes the same browser as tools for Claude Code, Claude Desktop, Cursor and Codex.

The install URL

The package is not on npm. Agent Vault hosts it as a self-contained tarball:
Self-hosting Agent Vault? Copy the whole block from the framework picker on your dashboard’s Overview page instead: it fills in your deployment’s install URL, proxy URL and API URL. Changing only the install URL sends your key to the hosted proxy and API, which do not recognise it.
Only use an http:// install URL for localhost or 127.0.0.1. The package runs on your machine, and anyone on the network path could replace it.

Install

1

Add the package

The URL has no version number, so it never changes. Each deployment serves its current build, and the version is in the installed package’s package.json. Run the install again to upgrade.
2

Set the environment variables

All three are needed:
  • Without the API key, listTokens() and chromium.launch() throw no API key.
  • Without the proxy URL, the SDK targets a local proxy at ws://localhost:4000/v1 and chromium.launch() fails with Failed to connect to proxy.
  • Without the API URL, listTokens() fails.
A process that serves several keys can instead pass apiKey and proxyUrl to chromium.launch(), and apiKey and baseUrl to listTokens(). See Launching. The full list is on Environment variables.
3

Check the catalog

The snippet uses top-level await: save it as check.mjs, or set "type": "module" in your package.json.
This needs no browser. If it throws invalid_api_key, check the key on the dashboard’s API keys page.

Run a checkout

The proxy resolves each token at fill time, so the merchant receives a real card while your process never handles the card number or security code. It does see the real expiry, brand and last 4 digits.
The card order in step 6 matters. Filling the number authorizes the security code that follows it exactly once, and any action in between asks the account holder to approve the purchase a second time. See Card order.

Next steps

API reference

Exports, the browser object model and the catalog helpers.

Sessions and timeouts

Which errors end a session and which do not.

Error codes

What each refusal means and whether to retry.

First checkout

A guided checkout, end to end.