Skip to content

observe() — Read Browser State

The observe tool reads the current browser state. It’s your AI’s eyes into the browser — errors, network traffic, WebSocket messages, performance metrics, visual state, and more.

Always call observe() before interact() or generate() to give the AI context about the current page.

observe({what: "errors"}) // Console errors
observe({what: "error_bundles"}) // Errors with full context
observe({what: "logs", min_level: "warn"}) // Console output
observe({what: "network_bodies", url: "/api", status_min: 400}) // Failed API calls
observe({what: "websocket_events", last_n: 10}) // WebSocket messages
observe({what: "screenshot"}) // Page screenshot
observe({what: "vitals"}) // Web Vitals (LCP, CLS, INP)
observe({what: "accessibility"}) // WCAG audit

These parameters work across multiple modes:

ParameterTypeDescription
whatstring (required)Which mode to use (see sections below)
limitnumberMaximum entries to return
last_nnumberReturn only the last N items
urlstringFilter by URL substring
after_cursorstringBackward pagination — entries older than cursor
before_cursorstringForward pagination — entries newer than cursor
since_cursorstringAll entries newer than cursor (inclusive, no limit)
restart_on_evictionbooleanAuto-restart if cursor expired from buffer overflow

Console errors with deduplication. The starting point for any debugging session.

observe({what: "errors"})

Returns deduplicated errors with stack traces, source locations, and occurrence counts.

Pre-assembled debugging context per error. Each bundle includes the error plus the network requests, user actions, and console logs that happened near it.

observe({what: "error_bundles", window_seconds: 5})
ParameterTypeDefaultDescription
window_secondsnumber3How far back to look for related context (max 10)

This is the most powerful debugging mode — it gives the AI a complete incident report instead of a bare stack trace.

Groups similar errors together by message pattern. Useful for identifying the most common error categories.

observe({what: "error_clusters"})

All console output (log, warn, error, info, debug) with level filtering.

observe({what: "logs", min_level: "warn", limit: 50})
ParameterTypeDescription
min_levelstringMinimum level: debug < log < info < warn < error
limitnumberMaximum entries to return

Internal Gasoline extension debug logs. Not browser console output — use logs for that. Only useful for troubleshooting the Gasoline extension itself.

observe({what: "extension_logs"})

Resource timing data for all network requests (XHR, fetch, scripts, stylesheets, images). Shows URL, method, status, duration, and size.

observe({what: "network_waterfall", limit: 30})
observe({what: "network_waterfall", url: "/api"})
ParameterTypeDescription
limitnumberMaximum entries
urlstringFilter by URL substring

Full request and response payloads for fetch() calls. Filtered by URL, method, or status code.

observe({what: "network_bodies", url: "/api/users", status_min: 400})
observe({what: "network_bodies", method: "POST", limit: 5})
ParameterTypeDescription
urlstringFilter by URL substring
methodstringFilter by HTTP method (GET, POST, etc.)
status_minnumberMinimum status code (e.g., 400 for errors only)
status_maxnumberMaximum status code
limitnumberMaximum entries

Buffer: 100 recent requests, 8 MB total memory. Auth headers are always stripped.


Captured WebSocket messages and lifecycle events (open, close, error).

observe({what: "websocket_events", last_n: 20})
observe({what: "websocket_events", connection_id: "ws-3", direction: "incoming"})
ParameterTypeDescription
connection_idstringFilter by specific WebSocket connection
directionstringincoming or outgoing
last_nnumberReturn only the last N events
limitnumberMaximum entries

Buffer: 500 events max, 4 MB limit. High-frequency streams are adaptively sampled.

Live connection health — active connections, message rates, duration.

observe({what: "websocket_status"})

Returns connection ID, URL, state (open/closed), duration, and message rates per direction.


Current URL and page title.

observe({what: "page"})

All browser tabs with their URLs and titles.

observe({what: "tabs"})

Captures a screenshot of the current viewport. The AI receives the image and can reason about visual state — broken layouts, stuck spinners, hidden elements.

observe({what: "screenshot"})

Current state of AI Web Pilot — whether browser control is enabled or disabled.

observe({what: "pilot"})

Recent navigation history for the current tab.

observe({what: "history"})

Recorded user interactions — clicks, typing, navigation, scrolling. Each action includes a timestamp, the element targeted, and the selector used.

observe({what: "actions", last_n: 10})
observe({what: "actions", limit: 50})

Useful for understanding what the user did before an error occurred, or for generating reproduction scripts.


Core Web Vitals: LCP (Largest Contentful Paint), CLS (Cumulative Layout Shift), INP (Interaction to Next Paint), FCP (First Contentful Paint).

observe({what: "vitals"})

Each metric includes the value, the rating (good/needs-improvement/poor), and thresholds.

Performance snapshots with before/after comparison and regression detection.

observe({what: "performance"})

WCAG accessibility audit using axe-core. Returns violations, passes, and incomplete checks.

observe({what: "accessibility"})
observe({what: "accessibility", scope: "#main-content", tags: ["wcag2a"]})
ParameterTypeDescription
scopestringCSS selector to limit the audit scope
tagsarrayWCAG tags to test (e.g., wcag2a, wcag2aa, best-practice)
force_refreshbooleanBypass cached results

Scans captured data for security issues: leaked credentials, PII exposure, insecure headers, cookie misconfiguration, transport security, and auth problems.

observe({what: "security_audit"})
observe({what: "security_audit", checks: ["credentials", "pii"], severity_min: "high"})
ParameterTypeDescription
checksarrayWhich checks to run: credentials, pii, headers, cookies, transport, auth
severity_minstringMinimum severity: critical, high, medium, low, info

Analyzes third-party scripts and external dependencies loaded by the page.

observe({what: "third_party_audit"})
observe({what: "third_party_audit", first_party_origins: ["https://myapp.com"]})
ParameterTypeDescription
first_party_originsarrayOrigins to consider first-party
include_staticbooleanInclude origins that only serve static assets
custom_listsobjectCustom allowed/blocked/internal domain lists

Compare security snapshots to detect changes over time.

observe({what: "security_diff", action: "snapshot", name: "baseline"})
observe({what: "security_diff", action: "compare", compare_from: "baseline", compare_to: "current"})
observe({what: "security_diff", action: "list"})
ParameterTypeDescription
actionstringsnapshot (save), compare (diff two), list (show all)
namestringSnapshot name
compare_fromstringBaseline snapshot name
compare_tostringTarget snapshot name

Merged chronological view of all events — errors, network requests, user actions, console logs — interleaved by timestamp.

observe({what: "timeline"})
observe({what: "timeline", include: ["errors", "network"]})
ParameterTypeDescription
includearrayCategories to include (e.g., errors, network, actions, logs)

Retrieve the result of a previously-issued async command by correlation ID.

observe({what: "command_result", correlation_id: "abc123"})
ParameterTypeDescription
correlation_idstringThe ID returned when the async command was issued

List commands that are still waiting for execution by the extension.

observe({what: "pending_commands"})

List commands that failed during execution.

observe({what: "failed_commands"})

All buffer-backed modes support cursor-based pagination. The response includes a metadata object with cursor values:

{
"data": [...],
"metadata": {
"cursor": "1707325200:42",
"has_more": true
}
}

Pass the cursor back on the next request:

// Get next page (older entries)
observe({what: "logs", after_cursor: "1707325200:42"})
// Get new entries since last check
observe({what: "errors", since_cursor: "1707325200:42"})

If the cursor expires (buffer overflowed since last read), set restart_on_eviction: true to automatically restart from the oldest available entry instead of erroring.