DEV Community

Ahab
Ahab

Posted on Originally published at indieseek.co

Cloudflare Browser Run recording Inspect: debug AI agents without leaking secrets

Cloudflare Browser Run recording Inspect: debug AI agents without leaking secrets

Quick answer

Cloudflare added an Inspect panel to Browser Run Session Recordings on September 18, 2026. After a recorded session closes, you can search console logs, inspect network requests and timing, review the final DOM, or download network activity as raw JSON or HAR. This turns a failed browser-agent run into evidence you can replay instead of a vague “the click did not work.”

Treat that evidence as sensitive. Recording is opt-in and still beta. Input fields are masked in the rrweb replay, but Cloudflare documents that the network view and API can include available request and response headers, payloads, and responses. A HAR export therefore needs its own access, redaction, retention, and sharing rules. Do not assume replay masking also sanitizes network evidence.

Who this is for

This guide is for teams running AI browser agents or scripted Playwright, Puppeteer, CDP, or MCP workflows on Browser Run. It is especially useful when a run opens several tabs, fails only in production, or needs a shareable incident artifact.

Do not record every production session. Prefer a smaller unit test, synthetic page, or application log when it already proves the failure. Recordings are for hard-to-reproduce navigation, DOM, console, and network interactions.

Our Chrome DevTools MCP debugging workflow covers how to give an agent browser evidence without handing over an entire logged-in profile. This article handles a different task: collecting and releasing a bounded Browser Run incident package after the remote session ends.

What changed, and what did not

Session Recording already captured DOM changes, mouse and keyboard events, and navigation as structured rrweb events rather than video. The new Inspect panel adds three practical views:

View Useful evidence Important boundary
Logs Searchable console output and level filters Logs can still contain application data written by your own code.
Network Method, status, headers, payload, response, sizes, and timing waterfall; raw JSON or HAR via API Replay input masking does not prove network fields are safe to share.
DOM Expandable end-of-recording structure and reconstructed HTML It is the final reconstructed DOM, not a pixel-perfect capture of every visual state.
Replay Per-tab rrweb event timeline Canvas, WebGL, cross-origin iframe contents, and media playback are not captured.

The feature remains beta and opt-in for Browser Sessions through launch() or CDP—not Quick Actions. Enable it when acquiring the session; reconnecting cannot turn it on later. The artifact appears after the browser closes, and the API can briefly return 404 while finalizing. Recordings are retained for 30 days; the maximum recorded session is two hours.

A safe evidence workflow

  1. Start synthetic. Reproduce against a test account and non-secret fixtures. Remove customer data before recording.
  2. Constrain egress. Use Browser Run guardrails to allow only the target hostnames and required third-party domains. A recording explains what happened; an allowlist limits what the agent can reach.
  3. Enable at acquisition. Set recording: true for Puppeteer or Playwright, or add recording=true to CDP. Capture sessionId before closing.
  4. Close deliberately. Call browser.close() so finalization starts. Treat a short-lived 404 as pending only when the session is closed; retry with bounded backoff.
  5. Join tab and network evidence. Read target IDs from result.events; each normally represents a tab. Request network activity only for the target under investigation.
  6. Redact before export. Scan URLs, queries, cookies, authorization headers, bodies, logs, and reconstructed HTML. Remove credentials and personal data. Restrict any policy-required original.
  7. Publish a minimal bundle. Share only version, session ID hash, target, time, failed action, relevant logs/requests, DOM fragment, redaction record, and conclusion. Delete local copies when the incident closes.

For an MCP client, the acquisition URL has this shape:

wss://api.cloudflare.com/client/v4/accounts//browser-rendering/devtools/browser?recording=true&keep_alive=600000
Enter fullscreen mode Exit fullscreen mode

Do not put a real API token in a ticket or HAR. Keep authorization in the client's secret configuration, and record only whether the credential path succeeded.

Decision tree and release gate

Can a smaller synthetic test reproduce the failure?
  Yes -> use that artifact; avoid recording production data.
  No  -> continue.

Can the session run with test credentials and hostname guardrails?
  No  -> stop and redesign the test boundary.
  Yes -> record one bounded session.

Did the session close and the API finalize?
  No  -> wait with capped retries; do not call 404 permanent loss yet.
  Yes -> map the failing tab to its target ID.

Has every exported field passed redaction review?
  No  -> keep the bundle restricted.
  Yes -> release the minimal sanitized incident bundle.
Enter fullscreen mode Exit fullscreen mode

Use this receipt:

browser_run_mode: puppeteer | playwright | cdp | mcp
session_id_hash: 
recording_enabled_at_acquisition: yes | no
session_closed_at: 
finalization_attempts: 
target_id: 
evidence_used: logs | network-json | har | final-dom | replay
guardrails: 
redaction_checks: url | headers | cookies | bodies | logs | dom
retention_owner_and_delete_at: 
result: release-sanitized | restricted | reject
Enter fullscreen mode Exit fullscreen mode

Common mistakes

  • Assuming masked input fields make the HAR safe. Replay and network artifacts have different data surfaces.
  • Treating an immediate API 404 as permanent loss before a closed session finishes finalizing.
  • Exporting all tabs when only one target contains the failure, which expands both noise and exposure.
  • Expecting a DOM replay to capture canvas, WebGL, cross-origin iframe content, or video state.
  • Enabling recording everywhere by default. Opt in only where the debugging value justifies 30-day provider retention.

Building something? Turn your product page into a show people want to watch with PromoFast—hosted, embeddable, and ready to export.

FAQ

Is Session Recording a video?

No. Cloudflare records structured rrweb events such as DOM changes, input events, and navigation. That keeps the artifact inspectable but means several visual surfaces are incomplete.

Can I enable recording after reconnecting to a session?

No. It must be enabled during initial session acquisition.

Does a 404 mean the recording failed?

Not necessarily. After the session closes, the API may briefly return 404 while the recording finalizes. Use a bounded retry and keep the close timestamp in the receipt.

Is a HAR safe to send to an AI coding agent?

Only after review and redaction. Give the agent the minimum requests needed to diagnose the issue, and exclude credentials, cookies, personal data, and unrelated responses.

Sources

Originally published on IndieSeek.

Top comments (0)