You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
browser-use exposes token/cost tracking for LLM calls. OpenChrome usually cannot observe the MCP host's LLM token accounting, but it can measure the payloads it emits and the browser/CDP work required to produce them. That is enough to prevent regressions in speed and context size.
Related existing work: #846 (performance insights), #869/#870 (notifications/progress/logging), #897 (byte-aware console buffer). This issue is narrower: payload budget telemetry for browser tool responses.
Goal
Add lightweight payload and latency telemetry to high-frequency tools so optimization claims can be verified after merge.
Scope
For at least read_page, inspect, query_dom, extract_data, crawl, and screenshot-producing tools, expose debug/metadata fields or logs for:
outputChars
estimatedOutputTokens using a documented heuristic such as ceil(chars / 4)
toolLatencyMs
browserLatencyMs or CDP/evaluate timing when available
domNodesVisited
domNodesEmitted
compressionRatio where applicable
deltaSavedChars where snapshot delta applies
screenshotBytes / screenshotFormat where applicable
artifactBytes if output handles are used
Required behavior:
Keep telemetry compact by default.
Expose detailed timing only with debug/diagnostic mode or through logs/metrics.
Do not include sensitive page content in metrics.
Add a small benchmark or test fixture that fails if compact output regresses dramatically without an explicit snapshot update.
Non-goals
Do not claim exact LLM billing unless the MCP host provides usage data.
Do not fetch external pricing data in core server code.
Do not add a heavy observability dependency.
Implementation notes
Reuse existing metrics collector where possible.
Prefer per-tool meta or metrics object over embedding prose.
Keep telemetry metadata bounded and opt-in/debug where needed.
Implementation checklist
Expose fields such as outputChars, estimatedOutputTokens, latencyMs, screenshot bytes/path, truncation, compression, cache status, and warning thresholds for target tools.
Instrument at least read_page, inspect, query_dom, extract_data, crawl, and screenshot-producing tools as scoped or document staged coverage.
Use local estimates only and avoid external tokenizer/API calls.
Add tests for metric presence, bounds, latency field shape, disabled/default behavior, and no payload-content regression.
Document telemetry interpretation and regression workflow.
Success criteria
Maintainers can verify payload/latency regression claims after merge.
Telemetry does not materially increase default response size.
Metrics are deterministic enough for tests where applicable.
No external token/cost service is required.
Post-merge OpenChrome live verification checklist
Run representative local calls for read_page/inspect/extract/crawl/screenshot and verify telemetry fields.
Compare enabled vs disabled/default response size.
Verify threshold warnings on a large fixture output.
Include sanitized telemetry JSON and fixture commands in merge notes.
Background
browser-use exposes token/cost tracking for LLM calls. OpenChrome usually cannot observe the MCP host's LLM token accounting, but it can measure the payloads it emits and the browser/CDP work required to produce them. That is enough to prevent regressions in speed and context size.
Related existing work: #846 (performance insights), #869/#870 (notifications/progress/logging), #897 (byte-aware console buffer). This issue is narrower: payload budget telemetry for browser tool responses.
Goal
Add lightweight payload and latency telemetry to high-frequency tools so optimization claims can be verified after merge.
Scope
For at least
read_page,inspect,query_dom,extract_data,crawl, and screenshot-producing tools, expose debug/metadata fields or logs for:outputCharsestimatedOutputTokensusing a documented heuristic such asceil(chars / 4)toolLatencyMsbrowserLatencyMsor CDP/evaluate timing when availabledomNodesVisiteddomNodesEmittedcompressionRatiowhere applicabledeltaSavedCharswhere snapshot delta appliesscreenshotBytes/screenshotFormatwhere applicableartifactBytesif output handles are usedRequired behavior:
debug/diagnostic mode or through logs/metrics.Non-goals
Implementation notes
metaormetricsobject over embedding prose.structuredContentwork (feat(core): outputSchema + structuredContent for Tier-1 read tools (mcp-servers adoption 5) #871) lands first, place metrics in structured content.Success criteria
estimatedOutputTokensis an approximation, not provider billing.Real OpenChrome validation after implementation
Use real Chrome through OpenChrome.
navigatetohttps://github.com/browser-use/browser-useread_pagein normal/full moderead_pagein compact mode if availableinspectwith a focused queryextract_datafor repo metadataoutputCharsandestimatedOutputTokensfor each calltoolLatencyMsdomNodesVisitedanddomNodesEmittedfor DOM toolsestimatedOutputTokens ~= ceil(outputChars / 4)).Review checklist
Self-review clarifications (added before implementation)
metricsobject where the response format permits it; avoid prose-only metrics.estimatedOutputTokensmust be computed from the serialized response body that the MCP host receives, not from internal pre-redaction content.null; do not use misleading zero values.read_pageplus one ofinspect/extract_data; screenshots/crawl can follow if needed.Curated scope, overlap handling, and verification checklist
Scope classification
feat/981-inspect-metrics). Continue there; do not duplicate the PR.Overlap and conflict resolution
Implementation checklist
read_page,inspect,query_dom,extract_data,crawl, and screenshot-producing tools as scoped or document staged coverage.Success criteria
Post-merge OpenChrome live verification checklist