Playwright MCP snapshots cost me 22,556 tokens per page. Here's what I measured
If you let Claude Code, Codex or Cursor drive a browser, a big part of your token bill is page snapshots your agent reads over and over. I measured it, then built Deputy to cut it: https://razin.ai/deputy?ref=devto Disclosure: Deputy is my product, so read this as a builder’s notes. The method and raw numbers are public and you can rerun them.
如果你让 Claude Code、Codex 或 Cursor 驱动浏览器,你账单中很大一部分代币开销来自于你的代理反复读取的页面快照。我对此进行了测量,并构建了 Deputy 来削减这一开销:https://razin.ai/deputy?ref=devto。披露:Deputy 是我的产品,所以请将其视为开发者的笔记。测量方法和原始数据是公开的,你可以重新运行它们。
Where the tokens go Playwright MCP gives your agent an accessibility snapshot of the page. That snapshot goes into the conversation, and every later call to the model reads the whole conversation again. I ran one task on an admin dashboard with 400 orders: filter to status Refunded, placed on or after 2026-08-01, count the matches. Claude Sonnet in Claude Code, medians of 3 runs, every run passed. Context per model call with Playwright MCP, in thousands of tokens: 19.2, 21.1, 22.1, 44.6, 45.3, 45.5, 46.3 The jump from 22 to 44 is one snapshot of the dashboard: 22,556 tokens. Every call after it pays for it again.
代币消耗去向:Playwright MCP 为你的代理提供页面的辅助功能快照。该快照会进入对话中,后续对模型的每一次调用都会再次读取整个对话。我在一个包含 400 个订单的管理仪表板上运行了一个任务:筛选状态为“已退款”、下单日期在 2026 年 8 月 1 日或之后的订单,并统计匹配数量。在 Claude Code 中使用 Claude Sonnet,取 3 次运行的中位数,每次运行均通过。使用 Playwright MCP 时,每次模型调用的上下文(以千个代币为单位):19.2、21.1、22.1、44.6、45.3、45.5、46.3。从 22 到 44 的跳跃是仪表板的一次快照:22,556 个代币。此后的每一次调用都要再次支付这笔费用。
What Deputy does instead Deputy is a Chrome extension plus a small local MCP server. Your agent asks Deputy for the page and gets the page’s forms back as typed tools: each form is one call with named, typed fields, plus a short list of things to click. One call fills the whole form. Same task, same model: Playwright MCP Deputy agent turns 10 3 Claude tokens 245,250 72,632 page data sent to the agent 46,640 chars 7,269 chars total cost $0.189 $0.072 Against Vercel’s agent-browser, all 12 runs passed: agent-browser Deputy dashboard: turns / tokens 11 / 271,172 3 / 72,756 7-field booking form: turns / tokens 7 / 155,200 3 / 68,683 Part of agent-browser’s count is the usage guide its docs tell the agent to load first. It runs in your own Chrome Fewer tokens was the first reason. The second is that Deputy works inside the Chrome you already use: The agent is logged in where you are. No separate browser profile, no logging in again. No debugger permission, so no “controlled by automated test software” bar. Anything that submits a form stops and asks you on the page first. The MCP server is local and listens on 127.0.0.1 only.
Deputy 的替代方案:Deputy 是一个 Chrome 扩展程序加上一个小型本地 MCP 服务器。你的代理向 Deputy 请求页面,并以类型化工具的形式获取页面的表单:每个表单是一次调用,包含命名和类型化的字段,以及一个简短的可点击列表。一次调用即可填好整个表单。相同任务、相同模型:Playwright MCP 与 Deputy 的对比,代理轮次分别为 10 和 3,Claude 代币分别为 245,250 和 72,632,发送给代理的页面数据分别为 46,640 字符和 7,269 字符,总成本分别为 $0.189 和 $0.072。对比 Vercel 的 agent-browser,所有 12 次运行均通过:agent-browser 与 Deputy 在仪表板任务中,轮次/代币分别为 11/271,172 和 3/72,756;在 7 字段预订表单中,轮次/代币分别为 7/155,200 和 3/68,683。agent-browser 的部分计数来自于其文档要求代理首先加载的使用指南。它在你自己的 Chrome 中运行,减少代币是第一个原因。第二个原因是 Deputy 在你已经使用的 Chrome 中工作:代理与你处于相同的登录状态。无需单独的浏览器配置文件,无需再次登录。没有调试器权限,因此不会出现“受自动化测试软件控制”的栏。任何提交表单的操作都会先停止并询问你。MCP 服务器是本地的,仅监听 127.0.0.1。
Try it in two minutes Add the extension from the Chrome Web Store (link on https://razin.ai/deputy?ref=devto). Connect your agent. For Claude Code: claude mcp add deputy — npx -y deputy-mcp Codex, Cursor, Gemini CLI, Copilot CLI, VS Code and others have one-line setups on the same page. Needs Node.js 20 or later. Then open a page and tell your agent what to do there.
两分钟内试用:从 Chrome 网上应用店添加扩展程序(链接见 https://razin.ai/deputy?ref=devto)。连接你的代理。对于 Claude Code:使用 claude mcp add deputy -- npx -y deputy-mcp。Codex、Cursor、Gemini CLI、Copilot CLI、VS Code 等在同一页面上都有单行设置。需要 Node.js 20 或更高版本。然后打开一个页面并告诉你的代理在那里做什么。
Free and Pro Free, no key: 10 tools. Open and read pages, fill forms in one call, click and type. No model of ours involved, nothing sent to us. Pro, $9.99 a month or $95.99 a year: all 27 tools (tabs, scrolling, uploads, tables, dialogs, console, network, screenshots), plus our hosted model reading pages and screenshots for your agent, up to 5,000 answers a month. Your agent gets a one-sentence answer back instead of spending its own tokens reading the page. Cancel any time, full refund within 14 days.
免费版与专业版:免费版无需密钥,包含 10 个工具。可以打开和读取页面、一次调用填写表单、点击和输入。不涉及我们的模型,没有任何数据发送给我们。专业版每月 $9.99 或每年 $95.99:包含全部 27 个工具(标签页、滚动、上传、表格、对话框、控制台、网络、截图),外加我们的托管模型为你的代理读取页面和截图,每月最多 5,000 次回答。你的代理会收到一句简短的回答,而不是消耗自己的代币去读取页面。随时可以取消,14 天内全额退款。
Where it doesn’t win On small pages the gap shrinks. A booking form against Playwright MCP was 107,392 vs 68,551 tokens, not 3x. A short Wikipedia lookup was about equal. Typed tools need real forms. Of 8 sites I swept (DuckDuckGo, Wikipedia, GitHub search, HN login, npm, MDN, a W3C form demo, Stack Overflow), 7 gave typed tools on first load. Wikipedia’s appearance settings still get tool names from field ids. Clicks and keys are synthetic events, so heavy editors like Google Docs may ignore them. If you only test your own app in CI, Playwright itself (the test runner) is still the right tool. If you stay on Playwright MCP, —snapshot-mode incremental helps.
局限性:在小型页面上,差距会缩小。针对 Playwright MCP 的预订表单代币消耗为 107,392 对 68,551,并非 3 倍差距。简短的维基百科查询几乎相等。类型化工具需要真实的表单。在我扫描的 8 个网站中(DuckDuckGo、维基百科、GitHub 搜索、HN 登录、npm、MDN、W3C 表单演示、Stack Overflow),有 7 个在首次加载时提供了类型化工具。维基百科的外观设置仍然从字段 ID 获取工具名称。点击和按键是合成事件,因此像 Google Docs 这样复杂的编辑器可能会忽略它们。如果你只在 CI 中测试自己的应用程序,Playwright 本身(测试运行器)仍然是正确的工具。如果你继续使用 Playwright MCP,--snapshot-mode incremental 会有所帮助。
Links Deputy, install and pricing: https://razin.ai/deputy?ref=devto Measurements and method: https://github.com/zraisan/deputy/blob/master/docs/measurements.md Open-source version: https://github.com/zraisan/deputy Start on Free and watch what your own token counts do: https://razin.ai/deputy?ref=devto. If you rerun the numbers and get something different, tell me in the comments.