@browseragentprotocol/protocol and as Pydantic models in the Python SDK.
BAPSelector
A union type representing one of the 10 selector types. Used in all action and observation methods.- TypeScript
- Python
InteractiveElement
Returned byagent/observe. Represents a single interactive element on the page with a stable reference, selector, and metadata.
string
required
Stable element reference ID (e.g.,
"@e1" or "@submitBtn"). Persists across observations for
the same element.BAPSelector
required
Pre-computed selector that uniquely targets this element. Use this directly in action methods.
string
required
ARIA role (e.g.,
"button", "textbox", "link", "checkbox").string
Accessible name of the element.
string
Current value (for input elements).
string[]
required
What actions can be performed:
"clickable", "editable", "selectable", "checkable",
"expandable", "draggable", "scrollable", "submittable".string
required
HTML tag name (e.g.,
"button", "input", "a").ElementBounds
Bounding box
{ x, y, width, height } if includeBounds was requested.boolean
Whether the element currently has focus.
boolean
Whether the element is disabled.
RefStability
Ref stability indicator:
"stable" (same element, same ref), "new" (newly discovered),
"moved" (element found but ref changed).BAPSelector[]
Alternative selectors ordered by reliability: testId, role+name, css #id, text, css path.
ExecutionStep
Defines a single step in anagent/act sequence.
string
required
The BAP method to execute (e.g.,
"action/click", "action/fill", "page/navigate").Record<string, unknown>
required
Parameters for the action.
string
Human-readable label for logging and debugging.
StepCondition
Pre-condition that must be met before execution. Object with
selector, state ("visible" |
"enabled" | "exists" | "hidden" | "disabled"), and optional timeout.string
Error handling strategy:
"stop" (default), "skip", or "retry".number
Max retries if
onError is "retry" (1-5).Building Steps
- TypeScript
- Python
AgentActResult
Returned byagent/act. Contains results for each step and optional fused observations.
number
required
Number of steps completed successfully.
number
required
Total number of steps in the sequence.
boolean
required
Whether all steps succeeded.
StepResult[]
required
Results for each step in order. Each contains
step (index), success, duration, optional
result data, and optional error.number
required
Total execution time in milliseconds.
number
Index of the first failed step (if any).
AgentObserveResult
Pre-execution observation result (if
preObserve was set).AgentObserveResult
Post-execution observation result (if
postObserve was set).AgentObserveResult
Returned byagent/observe. Contains the page snapshot.
ObserveMetadata
Page metadata:
url, title, viewport { width, height }.InteractiveElement[]
List of interactive elements with stable refs and selectors.
number
Total count on the page (may exceed the returned list if
maxElements was set).{ tree: AccessibilityNode[] }
Full accessibility tree (if
includeAccessibility was set).ObserveScreenshot
Screenshot data with
data (base64), format, width, height, annotated.AnnotationMapping[]
Mapping from annotation labels to element refs and positions (if screenshot annotation was used).
ObserveChanges
Incremental changes:
added, updated, removed (if incremental: true).WebMCPTool[]
WebMCP tools discovered on the page (if
includeWebMCPTools: true).AgentExtractResult
Returned byagent/extract.
boolean
required
Whether extraction succeeded.
unknown
required
Extracted data matching the provided schema.
ExtractionSourceRef[]
Source element references for extracted data (if
includeSourceRefs was set).number
Confidence score (0-1) for the extraction.
string
Error message if extraction failed.
ExtractionSchema
Simplified JSON Schema subset (max 2 levels deep) used byagent/extract:
Allowed Act Actions
These method names are permitted inExecutionStep.action: