Browser API Reference
Complete API documentation for AG-Kit browser automation tools, including method signatures, input/output schemas, and practical usage examples.API Overview
The browser API provides web automation capabilities through multiple components with consistent interfaces for different execution environments.Core Interfaces
UnifiedBrowserClient
Main browser client interface for session management and automation.UnifiedBrowserTool
High-level browser tool with unified action interface.Input Schemas
BrowserToolInput
BrowserActionType
Configuration Interfaces
Output Schemas
BrowserToolResult
Action Results
Method Reference
Navigation Methods
navigate()
Navigate to a URL.sessionId(string): Browser session identifierurl(string): Target URL to navigate totimeout(number, optional): Navigation timeout in milliseconds
NavigationResult
goBack()
Navigate back in browser history.goForward()
Navigate forward in browser history.reload()
Reload the current page.Element Interaction Methods
click()
Click on an element.sessionId(string): Browser session identifierselector(string): CSS selector for target element
ActionResult
type()
Type text into an input element.sessionId(string): Browser session identifierselector(string): CSS selector for input elementtext(string): Text to type
select()
Select an option from a dropdown.sessionId(string): Browser session identifierselector(string): CSS selector for select elementvalue(string): Option value to select
Data Extraction Methods
extractText()
Extract text content from elements.sessionId(string): Browser session identifierselector(string): CSS selector for target elements
ExtractionResult
extractAttribute()
Extract attribute values from elements.sessionId(string): Browser session identifierselector(string): CSS selector for target elementsattribute(string): Attribute name to extract
extractData()
Extract multiple data points using extractors.sessionId(string): Browser session identifierextractors(DataExtractor[]): Array of extraction configurations
Page Operation Methods
screenshot()
Capture a screenshot of the page.sessionId(string): Browser session identifieroptions(ScreenshotOptions, optional): Screenshot configuration
ScreenshotResult
scroll()
Scroll the page.waitForElement()
Wait for an element to appear.JavaScript Execution Methods
evaluate()
Execute JavaScript code in the page context.sessionId(string): Browser session identifiercode(string): JavaScript code to execute
EvaluationResult
injectScript()
Inject a JavaScript file into the page.Session Management Methods
createSession()
Create a new browser session.closeSession()
Close a browser session.getSessionInfo()
Get information about a session.Error Handling
Error Types
Error Examples
Factory Functions
createLocalBrowserTool()
Create a browser tool for local Playwright execution.createSandboxBrowserTool()
Create a browser tool for E2B sandbox execution.Type Definitions
Complete Type Reference
Related Documentation
- Browser Tools Guide - Comprehensive usage guide
- E2B Sandbox Integration - E2B-specific configuration
- Playwright Documentation - Underlying API reference