← Back to library

通过 DOM 提取优化将多代理成本降低 41%

社区实战指出用 browser.evaluate 返回结构化 JSON、减少 snapshot/screenshot 体积,可显著降低 token 成本并提升稳定性。

REDDITDiscovered 2026-02-11Author u/nkondratyk93
Prerequisites
  • Browser tasks with high token/snapshot cost are identified from logs.
  • A JSON schema for extracted DOM signals is defined.
Steps
  1. Replace large snapshots with targeted browser.evaluate extraction of required fields.
  2. Normalize extracted payloads and persist lightweight run metrics.
  3. Build dashboard panels for token usage, failure rate, and runtime per workflow.
  4. Iterate selectors/queries based on breakage alerts from UI changes.
Commands
openclaw gateway status
npm run build
Verify

Dashboard shows measurable drop in token usage while task success rate remains stable.

Caveats
  • Over-optimized extraction may miss context needed for edge-case decisions.
  • Reported 41% cost reduction is case-specific and should be benchmarked locally(需验证).
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post