Skip to main content
RPA (Robotic Process Automation) lets your agents navigate websites, fill forms, click buttons, extract data, and download files using a real browser. Built on top of Playwright.

Installation

Playwright is an optional peer dependency. Install it alongside the browser binaries:
Or use the CLI shortcut:
Check your setup:

Quick Start

The simplest way to use RPA is with createBrowserTool — it manages the browser lifecycle automatically.
Then add it to your agent:

createBrowserTool

Factory function that wraps your browser logic into a Runflow tool with automatic lifecycle management.
What it handles for you:
  • Launches the browser before your execute runs
  • Closes the browser after (even on errors)
  • Takes an error screenshot automatically if screenshotsDir is configured
  • Attaches RPA trace data to the output for observability
  • Validates input/output with Zod schemas

Browser Configuration

BrowserSession

For more control, use BrowserSession directly. This is useful when you need multiple pages, custom lifecycle, or manual tracing.

Key Methods

Properties

Observability

Every BrowserSession tracks actions and artifacts. Get a summary with:
When using 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.
Options: 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.
FormField options: 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.
Returns an array of objects where keys are column headers.

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

Use slowMo and headless: false during development to watch the browser:
Use rf test to run your agent locally with a visible browser.