Installation
Playwright is an optional peer dependency. Install it alongside the browser binaries:Quick Start
The simplest way to use RPA is withcreateBrowserTool — it manages the browser lifecycle automatically.
createBrowserTool
Factory function that wraps your browser logic into a Runflow tool with automatic lifecycle management.- Launches the browser before your
executeruns - Closes the browser after (even on errors)
- Takes an error screenshot automatically if
screenshotsDiris configured - Attaches RPA trace data to the output for observability
- Validates input/output with Zod schemas
Browser Configuration
BrowserSession
For more control, useBrowserSession directly. This is useful when you need multiple pages, custom lifecycle, or manual tracing.
Key Methods
Properties
Observability
EveryBrowserSession tracks actions and artifacts. Get a summary with:
createBrowserTool, this trace is automatically attached to the tool output as _rpaTrace.
High-Level Actions
Helper functions for common browser patterns. Import from@runflow-ai/sdk/rpa.
login
Automate login flows with smart field detection.
Auto-detection works for most login pages. It finds the first text input for username, the password input, and the submit button by common labels (
Login, Entrar, Sign In, etc.).
fillForm
Fill multiple form fields with flexible locators.
Locator priority:
selector > role + label > role > label.
clickButton
Click a button by its visible label.waitAndClick
Wait for an element to appear, then click it.extractTable
Extract an HTML table into structured data.extractText
Extract text content from matching elements.downloadFile
Click an element to trigger a download and wait for it to complete.screenshotPage
Take a full-page screenshot.waitForResponse
Wait for a network response matching a URL pattern.Full Example: CRM Login + Data Extraction
Agent-Level RPA Config
You can also configure RPA at the agent level:Agents with RPA tools are automatically detected during deploy and receive the
rpa capability flag. This routes them to RPA-enabled workers with Chromium pre-installed.Debugging
UseslowMo and headless: false during development to watch the browser:
rf test to run your agent locally with a visible browser.