bugAgent Tools (SDK)
Capture the last 60 seconds of user activity, run WCAG accessibility evaluations, and automate browser testing with Playwright — all before filing a report.
A lightweight JavaScript SDK records clicks, navigation, console errors, console warnings, network failures, DOM mutations, and URL history in a rolling buffer. When a user reports an issue, the SDK captures a page screenshot, a DOM replay snapshot, and optionally a screen + voice recording or annotated screenshot markup — then sends everything to the AI Assistant, which analyzes the recording and auto-drafts a structured report — whether it's a bug, feature request, enhancement, or any other supported type.
Always-on rolling capture of events and DOM mutations. No recording to start or stop.
Optional screen recording with microphone via the FAB toolbar. 3-second countdown, up to 60 seconds.
The AI Assistant reads events, DOM replay, and video to draft the bug report for you.
MutationObserver records DOM changes for visual replay of what the user saw.
Draw circles, arrows, and freehand annotations on screenshots in 7 colors before sending to the AI.
Replay the last 5 user actions in real time — clicks, form inputs, scrolls, and page navigations are re-executed automatically in the browser.
One-click accessibility evaluation powered by axe-core. Scans 80+ WCAG 2.0/2.1 rules with zero false positives. Results auto-included in the bug report.
No continuous recording. Input values are masked. No request bodies. Screenshot only on submit.
Under 15KB. No external dependencies. Zero performance impact.
Quick Start
Add one script tag to your website and the SDK is live. No build tools, no configuration files, no npm install required.
Go to Settings in the bugAgent dashboard and copy your API key.
Paste this before your closing </body> tag:
<script
src="https://app.bugagent.com/sdk/bugagent-sdk.js"
data-key="ba_live_your_key_here"
data-position="bottom-right">
</script> A floating bug icon appears on your site. Click it, then click "Send Session & Report Bug." The last 60 seconds of activity are captured and sent to the AI Assistant for analysis.
The bugAgent dashboard opens with the AI Assistant pre-loaded. It presents a draft bug report based on what it found in the session — errors, failed requests, user navigation path. Confirm or edit, then submit.
app.bugagent.com in your browser settings for screen recording to work. Most browsers block popups by default — look for a notification in your address bar when you first attempt to record.
How It Works
The SDK runs silently on your page, capturing user interactions in a rolling 60-second buffer. Nothing is sent until the user clicks "Report Bug."
When the user clicks the bug button, the buffer is frozen. A page screenshot is captured and a metadata snapshot is taken (URL, title, viewport, user agent). Everything is sent to /api/sessions/capture.
The AI reads the session events — clicks, navigation, URL history, console errors, console warnings, failed network requests — and generates a structured analysis with suggested title, description, repro steps, type, and severity.
The bugAgent dashboard opens with the AI Assistant pre-loaded with the analysis. It presents a draft bug report. The user confirms, edits, or adds voice/text context. The report is created with the session replay attached for developers to review.
Installation
Script Tag (Recommended)
The fastest way to get started. No build tools required. Add the script tag to any HTML page.
<script
src="https://app.bugagent.com/sdk/bugagent-sdk.js"
data-key="ba_live_your_key_here"
data-position="bottom-right">
</script> The SDK initializes automatically when the script loads. It begins capturing events immediately.
Self-Hosted
If you prefer to host the SDK yourself, download bugagent-sdk.js and serve it from your own domain:
curl -o public/bugagent-sdk.js https://app.bugagent.com/sdk/bugagent-sdk.js Then reference it with the data-api attribute pointing to bugAgent:
<script src="/bugagent-sdk.js" data-key="ba_live_..." data-api="https://app.bugagent.com"></script> Configuration
Configure the SDK using data-* attributes on the script tag:
data-key Required — Your bugAgent API key (starts with ba_live_) data-position Optional bottom-right Position of the floating bug button: bottom-right, bottom-left, top-right, top-left data-color Optional #F59E0B Brand color for the floating button (any valid CSS color) data-api Optional Current origin API base URL. Only needed if self-hosting the SDK. Full Example
<script
src="https://app.bugagent.com/sdk/bugagent-sdk.js"
data-key="ba_live_your_key_here"
data-position="bottom-left"
data-color="#3B82F6"
data-api="https://app.bugagent.com">
</script> API Key
The SDK authenticates using your bugAgent API key. To get your key:
data-key attribute
What Gets Captured
The SDK captures lightweight event data, DOM mutations, and a page screenshot automatically. Optionally, users can record their screen and voice via the FAB toolbar. Each event is a small JSON object with a type, timestamp, and relevant metadata.
Element tag, ID, class, and truncated text content. Position (x, y). No sensitive data.
Page URL and title on every route change. Wraps History API (pushState, replaceState) and popstate.
Intercepts console.error(), console.warn(), uncaught exceptions, and unhandled promise rejections. Each tagged with severity level.
URL, HTTP method, status code, and duration for every fetch and XHR request. Request and response bodies are never captured.
Throttled to every 250ms. Records scroll X/Y coordinates.
Which input fields the user interacted with. Values are always masked — only the element descriptor is recorded.
Debounced to 300ms. Records new width and height when the browser window is resized.
On load and on capture: URL, title, user agent, viewport dimensions, screen dimensions, document height.
A visual snapshot of the browser page captured at the moment of submission. Rendered via html2canvas, saved as JPEG, and attached to the bug report as a visual reference.
A chronological list of every page URL visited in the last 60 seconds with timestamps. Helps trace the user’s exact path leading up to the bug.
MutationObserver records DOM changes — child additions/removals, attribute changes, and text updates — in a rolling 60-second buffer. Combined with a full DOM snapshot at capture time, this enables visual replay of what the user saw.
Users can click the record button on the FAB toolbar to capture their screen and microphone. A 3-second countdown starts, then the browser records up to 60 seconds of video. The recording is uploaded as a WebM file and attached to the bug report alongside the session data.
Hover over the bug FAB to reveal the Annotate (pen) button. Click it to enter full-screen annotation mode with a toolbar offering 7 color swatches (red, amber, green, blue, purple, white, black) and 3 drawing tools: Circle (draw ellipses around elements), Arrow (point at something), and Freehand Draw. Use Undo to remove the last annotation or Cancel / ESC to exit without saving. Click Done to composite the annotations over the base screenshot, which replaces the auto-captured screenshot sent to the AI Assistant. Use the Reset button to clear any saved markup.
Hover over the bug FAB to reveal the Rewind button (counter-clockwise arrow). Click it to replay the last 5 user actions in real time. The SDK re-executes clicks, form inputs, checkbox toggles, scroll positions, and page navigations automatically with a ghost cursor overlay, progress bar, and element highlighting. Cross-page navigations are continued seamlessly via sessionStorage. Press ESC or click Stop to abort at any time.
Captures the last 50 console notifications — log, info, warn, error, and uncaught exceptions — with full stack traces. Displayed as a searchable, collapsible section in bug reports.
Captures failed (4xx/5xx) and slow (>1s) API requests with method, URL, status code, and duration. Displayed as a searchable, collapsible section in bug reports for quick diagnosis of backend issues.
Auto-captures page load time, first contentful paint, DOM ready time, FPS, memory usage, DOM node count, and long tasks at the time of report. Provides instant visibility into performance-related bugs.
One-click WCAG analysis powered by axe-core. Scans the current page for accessibility violations grouped by severity (critical, serious, moderate, minor) with element selectors and remediation links.
Record browser actions and generate Playwright test scripts via AI. Run on demand, set up scheduled recurring runs, or integrate into CI/CD pipelines. Failed tests automatically create bug reports. With the GitHub integration, scripts auto-push to your repo at tests/bugagent/{name}.spec.ts and stay in sync on every edit. Pro and Team plans include an automation coverage mind map on the dashboard.
AI Analysis
When a session is submitted, the AI Assistant immediately analyzes the event stream and produces a structured analysis:
- Suggested Title — A concise bug title derived from the errors and user actions observed
- Description — A detailed description of what went wrong, based on console errors, failed requests, and user behavior
- Reproduction Steps — Numbered steps generated from the click and navigation events
- Bug Type — Suggested classification (UI, Performance, Crash, Network, Logic, etc.)
- Severity — Suggested severity based on the impact and nature of the errors
- Key Findings — Highlighted observations like "500 error on checkout API" or "JavaScript crash in payment form"
The analysis is stored alongside the session and displayed on the bug report detail page. It is also injected into the the AI Assistant chat as context, so the AI can discuss the session with the user and refine the bug report before submission.
Dashboard View
When a session replay is attached to a bug report, developers see a dedicated section on the report detail page:
- Page Screenshot — A visual snapshot of the browser page at the moment of capture, attached as a media item. If the user annotated the screenshot using the markup tool, the annotated version (with circles, arrows, and drawings composited over the base image) is shown instead
- Session Metadata — Page URL, title, viewport size, capture timestamp
- User Journey — Chronological list of pages visited in the 60 seconds before the bug was reported (collapsible)
- User Activity — A readable log of user actions — clicks, navigation, errors, and warnings with timestamps (collapsible)
- Screen Recording — If the user recorded their screen, an embedded video player shows the WebM recording
- DOM Replay Badge — Shows the number of DOM mutations captured for visual replay
- Console Errors & Warnings — All
console.error()andconsole.warn()calls, plus uncaught exceptions - Failed Network Requests — HTTP requests that returned 4xx/5xx status codes or failed entirely
- Stack Trace / Console Log — The last 50 console notifications (log, info, warn, error, exceptions) with full stack traces, in a searchable, collapsible section
- Network Waterfall — Failed (4xx/5xx) and slow (>1s) API requests showing method, URL, status code, and duration, in a searchable, collapsible section
- Performance Metrics — Page load time, first contentful paint, DOM ready time, FPS, memory usage, DOM node count, and long tasks captured at the time of report
- WCAG Analysis Results — Accessibility violations grouped by severity (critical, serious, moderate, minor) with element selectors, WCAG criteria, and remediation links
- Playwright Automation Runs — Test execution results with pass/fail status, step-by-step logs, and screenshots from failed assertions
- AI Analysis — Key findings from the automated analysis (collapsible)
the AI Assistant Integration
bugAgent Tools (SDK) integrates directly with the AI Assistant. When a session is captured:
the AI Assistant receives the full event stream, console errors, network failures, and AI analysis as part of its system prompt.
Instead of asking questions, the AI Assistant immediately presents a pre-filled bug report based on what it observed in the session.
The user can edit the draft, add voice or text context, then confirm. The bug report is created with the replay attached.
This means the user never has to write a bug report from scratch. The AI does the work based on what actually happened in the browser.
Markup / Annotation
The SDK floating action button (FAB) includes a built-in annotation tool that lets users draw directly on a screenshot before submitting a bug report. This helps testers and users visually highlight exactly what went wrong.
How It Works
Hover over the bug FAB to reveal the pen icon (Annotate button) alongside the record button. Click it to enter full-screen annotation mode.
A toolbar appears at the top of the screen with 7 color swatches — red (default), amber, green, blue, purple, white, and black — and 3 drawing tools: Circle (draw ellipses around elements), Arrow (point at something), and Freehand Draw (sketch freely).
Draw on the screenshot to highlight problem areas. Use the Undo button to remove the last annotation if needed.
Click Done to composite your annotations over the base screenshot. The annotated image replaces the auto-captured screenshot and is sent to the AI Assistant. Press Cancel or ESC to exit without saving.
Additional Controls
- Undo — Removes the last annotation drawn. Can be pressed repeatedly to undo multiple strokes.
- Reset — Clears any previously saved markup from the FAB toolbar, restoring the original auto-captured screenshot.
- Cancel / ESC — Exits annotation mode without saving any changes.
- Done — Composites all annotations over the base screenshot and saves the result.
Rewind
The Rewind tool replays the last 5 meaningful user actions directly in the browser. Unlike a video replay, Rewind actually re-executes clicks, form inputs, scroll positions, and page navigations in real time — helping testers recall exactly what they just did before encountering a bug.
How It Works
Hover over the bug FAB to reveal the Rewind button (counter-clockwise arrow icon). Click it to start the replay.
A semi-transparent overlay covers the page with a progress bar showing each action as a numbered step. A ghost cursor moves to each target element in sequence.
Each action is performed in the browser automatically: buttons are clicked, form fields are filled character by character, checkboxes are toggled, select menus are changed, and scroll positions are restored. Target elements are highlighted with a blue outline during execution.
If a replayed action navigated to a different page, the remaining actions are queued in sessionStorage and automatically resumed after the new page loads.
Supported Actions
- Clicks — Re-executes
element.click()on the original target, found by CSS selector or coordinate fallback. - Text Input — Clears the field and retypes the value character by character with a realistic 40ms delay, dispatching
inputandchangeevents. - Checkboxes & Radios — Toggles the checked state and dispatches a
changeevent. - Select Menus — Sets the selected value and dispatches a
changeevent. - Scroll — Smoothly scrolls the page to the recorded position using
window.scrollTo(). - Navigation — Navigates to the recorded URL and resumes remaining actions on the new page.
Controls
- ESC key — Aborts the replay immediately and cleans up the overlay.
- Stop button — Visible in the progress bar, stops the replay at the current step.
id, data-testid, name attributes, or a CSS path up to 5 levels deep. If a selector fails, it falls back to elementFromPoint(x, y) using the original click coordinates. Actions that cannot find their target are gracefully skipped.
WCAG Accessibility Analysis
The WCAG Analysis tool runs a comprehensive accessibility scan on the current page using axe-core by Deque — the industry-standard engine used by Google Lighthouse and Chrome DevTools. It covers 80+ WCAG 2.0/2.1 Level A and AA rules with zero false positives.
How It Works
Hover over the bug FAB to reveal the WCAG Analysis button (accessibility icon). Click it to scan the page. axe-core is lazy-loaded from CDN on first use — no impact on SDK bundle size.
A popup overlay shows the results: rule violations, affected elements, and a breakdown by impact level (critical, serious, moderate, minor).
The results appear as a "WCAG Analysis" chip in the session popup. When you send to the AI, the findings are included in the payload and the AI generates a dedicated accessibility section in the bug report.
What Gets Checked
- Color Contrast — Text contrast ratios against WCAG AA thresholds (4.5:1 normal, 3:1 large text).
- Image Alt Text — Missing or empty alt attributes on images (WCAG 1.1.1).
- Form Labels — Inputs, selects, and textareas without associated labels or aria-label (WCAG 1.3.1).
- Link & Button Names — Interactive elements without accessible names (WCAG 2.4.4).
- ARIA Validation — Invalid roles, missing required attributes, and ARIA misuse.
- Heading Structure — Skipped heading levels, missing landmarks.
- Keyboard Navigation — Focus management, tab order, and keyboard traps.
- Document Structure — Missing lang attribute, page title, and landmark regions.
Report Output
Each violation in the bug report includes:
- Impact level — Critical, serious, moderate, or minor.
- Rule ID — The axe-core rule identifier (e.g.,
color-contrast,image-alt). - WCAG criteria — The specific WCAG success criterion violated.
- Element selector — CSS selector targeting the affected element.
- HTML snippet — The offending markup for quick identification.
- Remediation link — Direct link to Deque's documentation on how to fix the issue.
Privacy & Security
The SDK is designed to capture the minimum data needed to understand what happened, without exposing sensitive information.
- Click targets (element tag, ID, class)
- Page URLs and titles
- Console error messages
- Network request URLs, methods, and status codes
- Scroll position and viewport size
- Input field values (always masked)
- Passwords, credit card numbers, or form data
- Request or response bodies
- Cookies, localStorage, or sessionStorage
- Continuous screen recording or video capture
- DOM content or HTML source
API Reference
For advanced integrations, you can interact with the SDK API directly. See the full API Reference for details.
Submit Session
POST /api/sessions/capture
Content-Type: application/json
{
"apiKey": "ba_live_your_key_here",
"events": [...],
"snapshot": {
"url": "https://app.example.com/checkout",
"title": "Checkout - My App",
"userAgent": "Mozilla/5.0...",
"viewportWidth": 1440,
"viewportHeight": 900
},
"consoleErrors": [...],
"networkLog": [...]
} Response
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"dashboard_url": "/dashboard/reports?session=550e8400...",
"status": "analyzing"
} Endpoints
POST /api/sessions/capture Submit a session recording from the SDK GET /api/sessions List session replays for your organization GET /api/sessions/:id Get full session detail with events PATCH /api/sessions Attach a session to a bug report Plans & Limits
bugAgent Tools (SDK) is available on Pro, Team, and Enterprise plans.
403 error if they attempt to use the SDK. Upgrade to Pro to enable it.
Support
Need help with bugAgent Tools? We're here.