# Secure Playwright Browser Automation Runner (`moneyagent_lab/money-agent-browser-runner`) Actor

Secure declarative Playwright browser automation for AI agents and backend workflows. Navigate, click, fill, extract, assert, and screenshot with SSRF protection, bounded resources, structured audit trails, deterministic selector targeting, and per-action billing.

- **URL**: https://apify.com/moneyagent\_lab/money-agent-browser-runner.md
- **Developed by:** [Money Agent Lab](https://apify.com/moneyagent_lab) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 browser actions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Secure Playwright Browser Automation Runner

Run secure, declarative Playwright browser workflows for AI agents and backend automation — without arbitrary user JavaScript or Python.

**Navigate · Click · Fill · Extract · Assert · Screenshot**

- SSRF-protected network access
- Bounded runtime and resource usage
- Structured per-action audit trail
- Deterministic selector targeting
- Failed browser actions are not charged as browser actions
- **$4 per 1,000 successfully completed browser actions**

Production-like cloud validation matched expected behavior in **422/423 runs (99.76%)**, including **54/54 security cases**.

### Quick start

```json
{
  "startUrl": "https://example.com",
  "actions": [
    {"type": "getTitle"},
    {"type": "extractText", "selector": "h1"}
  ]
}
```

Each run produces one structured dataset result with execution status, action results, timing, security/network counters, and billing information.

### What it does

Start from a public HTTP(S) URL and execute up to 100 declarative browser actions:

- `goto`
- `waitForSelector`
- `click`
- `fill`
- `select`
- `extractText`
- `extractAttribute`
- `getTitle`
- `getUrl`
- `assertText`
- `screenshot`
- `wait`

Each run writes one structured result to the default dataset with the final status, per-action audit trail, timing, network/security counters, and billing information.

### Pricing

Primary billing event: **Browser action**.

- **$0.004 per successfully completed browser action** — $4 per 1,000 successful actions.
- Failed actions are not charged as browser actions.
- Initial `startUrl` navigation is not counted as a browser action.
- The runner checks the run spending limit before starting the next billable action and stops when the limit is reached.

Apify may also apply its small standard Actor-start charge shown in the run pricing details.

### Example input

```json
{
  "clientReference": "agent-job:abc-123",
  "startUrl": "https://example.com",
  "stopOnError": true,
  "maxRunSeconds": 120,
  "actions": [
    {"type": "getTitle"},
    {"type": "waitForSelector", "selector": "h1", "timeoutSeconds": 10},
    {"type": "extractText", "selector": "h1"},
    {"type": "screenshot", "key": "page-shot", "fullPage": true}
  ]
}
```

### Ambiguous selectors

Playwright strict selector behavior is preserved by default. If a selector intentionally matches multiple elements, choose a specific zero-based match with `matchIndex`:

```json
{
  "type": "extractText",
  "selector": "span.titleline > a",
  "matchIndex": 0
}
```

`matchIndex` is bounded from 0 to 999.

### Output

The dataset result includes fields such as:

- `runnerVersion`
- `clientReference`
- `passed`
- `startUrl` / `finalUrl`
- `actionsRequested`
- `actionsExecuted`
- `browserActionsCompleted`
- `billingMode`
- `browserActionsCharged`
- `chargeLimitReached`
- `elapsedMs`
- network/security counters
- per-action results and errors

Screenshots are stored as run artifacts and referenced from the action result.

### Security model

This Actor intentionally does **not** expose arbitrary user-supplied JavaScript or Python execution.

Network and execution boundaries include:

- public HTTP(S) destinations only;
- ports 80 and 443 only;
- private, loopback, link-local, reserved, and mixed public/private DNS destinations rejected;
- URL credentials rejected;
- DNS resolution checked before connecting and the proxy connects to the checked public IP;
- Chromium proxy bypass disabled for loopback destinations;
- WebSockets blocked;
- downloads blocked;
- service workers blocked;
- uncontrolled popups closed;
- non-proxied WebRTC/WebTransport restricted;
- QUIC disabled;
- maximum 300 proxied browser connections per run;
- maximum 64 MiB aggregate browser network transfer per run;
- maximum 100 actions;
- maximum 60 seconds per action;
- maximum 180 seconds per workflow;
- extracted string output capped at 200,000 characters per action;
- screenshot artifacts capped at 8 MiB;
- unknown input and action fields rejected.

These controls reduce SSRF, runaway-resource, and accidental high-cost risks, but they do not make arbitrary third-party automation authorized. Only automate websites and systems you are permitted to access.

### Reliability

Before public launch, the runtime completed a balanced 423-run production-like cloud test across navigation, forms, interaction, dynamic pages, screenshots, controlled failures, selector ambiguity, edge cases, and security cases. Expected behavior matched 422/423 runs (99.76%); all 54 security cases behaved as expected.

External websites can still change, throttle requests, or become unavailable. Use explicit selectors and appropriate timeouts for production workflows.

### Supported scope

Good fit:

- deterministic AI-agent browser tools;
- backend browser workflows;
- form and UI automation on authorized targets;
- extraction from dynamic pages;
- bounded QA and smoke tests;
- auditable browser steps.

Not supported by design:

- arbitrary JavaScript/Python execution;
- CAPTCHA bypass;
- private-network access;
- credential theft or unauthorized account access;
- browser extensions;
- residential-proxy scraping workflows;
- WebSocket-dependent applications;
- unrestricted browser control.

### Notes

`clientReference` can be used to correlate a run with an external job ID without putting secrets into the input. Do not include passwords, API keys, session cookies, or other secrets unless you have an appropriate secret-management path and are authorized to use them.

# Actor input Schema

## `clientReference` (type: `string`):

Optional caller-supplied ID used to correlate this run with an agent task, job, or backend request.

## `startUrl` (type: `string`):

Public HTTP(S) URL you are authorized to automate. Private networks, URL credentials, and non-web schemes are blocked.

## `actions` (type: `array`):

1-100 declarative browser actions. Successful actions are the future PPE billing unit.

## `stopOnError` (type: `boolean`):

Stop the workflow when the first action fails.

## `maxRunSeconds` (type: `integer`):

Hard limit for the full workflow duration.

## Actor input object example

```json
{
  "stopOnError": true,
  "maxRunSeconds": 120
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `artifacts` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("moneyagent_lab/money-agent-browser-runner").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("moneyagent_lab/money-agent-browser-runner").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call moneyagent_lab/money-agent-browser-runner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,moneyagent_lab/money-agent-browser-runner"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cmUmUXV47ZZJ9FHiG/builds/Bm11rH0Epi0ncf8FV/openapi.json
