Skip to main content

Tracing

BAP automatically records NDJSON traces for every session to ~/.bap/traces/. The bap trace command lets you view, filter, replay, and export these traces.

View Recent Traces

bap trace                    # Last 10 steps from most recent session
bap trace --limit=20         # Last 20 steps
bap trace --all              # All steps

List Sessions

bap trace --sessions
Shows all recorded trace sessions with timestamps and step counts.

Filter by Session

bap trace --session=cli-9222
--session
string
Show traces for a specific session ID.
--limit
number
default:"10"
Number of trace entries to show.
--all
flag
Show all trace entries instead of the default last 10.
--sessions
flag
List all recorded trace sessions.

Replay as HTML Timeline

Generate a self-contained HTML timeline viewer:
bap trace --replay
Opens an interactive timeline showing every request with timing, status, and result summary. The HTML file is self-contained — no external dependencies.
--replay
flag
Generate a self-contained HTML timeline viewer and save it to the current directory.

Export as JSON

bap trace --export
bap trace --export=my-traces.json
--export
string
Export traces as JSON. Optionally provide a filename.

Trace Data

Each trace entry includes:
  • Method — The BAP protocol method called (e.g., page/navigate, agent/act)
  • Timing — Request start time and duration in milliseconds
  • Status — Success or error
  • Result summary — Condensed result data
Use bap trace to debug failures. Every BAP command is recorded with timing and result data, making it easy to identify what went wrong and when.