# RAG Web Browser (`muhammadafzal/rag-web-browser`) Actor

Crawl public web pages and return clean, source-linked text chunks for RAG pipelines, vector search, question answering, and AI agents.

- **URL**: https://apify.com/muhammadafzal/rag-web-browser.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 rag chunk returneds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## RAG Web Browser

RAG Web Browser crawls public web pages and returns clean, retrieval-ready text chunks for vector databases, semantic search, question answering, and AI agents. It is designed for developers who need a predictable web-to-RAG data surface without receiving navigation bars, scripts, cookie banners, or other page boilerplate in every chunk.

### What it returns

Every dataset item is one homogeneous RAG chunk:

| Field | Description |
| --- | --- |
| `content` | Clean page text suitable for embedding or retrieval. |
| `sourceUrl` | URL that produced the chunk. |
| `canonicalUrl` | Page canonical URL when the source declares one. |
| `title` | Page title from Open Graph, the title element, or the first heading. |
| `headingPath` | The page headings found near the extracted content. |
| `chunkIndex` / `totalChunks` | Position of the chunk within its source page. |
| `wordCount` | Number of whitespace-separated words in the chunk. |
| `crawlDepth` | Link depth from the supplied start URL. |
| `fetchedAt` | ISO timestamp for the fetch. |

The `OUTPUT` key-value record contains `pagesFetched`, `chunksReturned`, `failedRequests`, and warnings. Diagnostics stay out of the homogeneous dataset so downstream embedding jobs can process every row consistently.

### When to use it

Use this Actor when you have one or more public URLs and want clean text for a RAG ingestion pipeline. It works well for documentation pages, knowledge bases, public articles, standards, manuals, product information, and ordinary HTML sites. Set `crawlLinks` to `true` when you want to follow links on the same host and use `maxPages` and `maxDepth` to bound the crawl.

Do not use it for authenticated applications, private intranets, JavaScript-only applications, sites that require a browser session, or targets where you do not have permission to crawl. It does not bypass login walls, paywalls, robots restrictions, or anti-bot challenges. Use a browser-based Actor or an authorized provider when the target requires rendering or credentials.

### Input example: one page

```json
{
  "startUrls": [{ "url": "https://docs.example.com/getting-started" }],
  "crawlLinks": false,
  "maxPages": 1,
  "chunkSize": 1200,
  "chunkOverlap": 150
}
```

### Input example: bounded documentation crawl

```json
{
  "startUrls": [{ "url": "https://docs.example.com/" }],
  "crawlLinks": true,
  "maxPages": 25,
  "maxDepth": 2,
  "chunkSize": 1200,
  "chunkOverlap": 150,
  "requestTimeoutSecs": 45
}
```

`maxPages` is the total page-fetch cap across the run. `chunkSize` is a character target rather than a token count; chunks prefer paragraph boundaries and long paragraphs are split at the configured bound. `chunkOverlap` repeats trailing context between adjacent chunks. The Actor clamps runtime values to safe limits even when an API caller bypasses the Console form.

### Output example

```json
{
  "chunkId": "aHR0cHM6Ly9kb2NzLmV4YW1wbGUuY29tLw-0",
  "sourceUrl": "https://docs.example.com/getting-started",
  "canonicalUrl": "https://docs.example.com/getting-started",
  "title": "Getting started",
  "description": "Install and configure the SDK.",
  "headingPath": ["Getting started", "Installation"],
  "content": "Getting started\n\nInstall the SDK ...",
  "contentType": "web-page",
  "chunkIndex": 0,
  "totalChunks": 3,
  "wordCount": 184,
  "crawlDepth": 0,
  "fetchedAt": "2026-08-13T18:00:00.000Z"
}
```

### Pricing

Pricing is pay per event: `$0.003 per returned RAG chunk` plus a `$0.00005` run-start event, with any Apify platform usage shown by the platform. The Actor has a `$0.30` maximum total event charge per run. A one-page run typically returns a small number of chunks, while long standards or manuals can return more because each chunk is a separate dataset item. Set `maxPages` and `chunkSize` to control the result volume and cost.

### Reliability and limits

The Actor uses a fast HTTP crawler for static HTML. It retries failed requests twice, limits concurrency, preserves valid partial results, and writes a terminal summary for every run. A malformed URL is rejected by the input schema. A valid page with no readable text completes with a warning and no fabricated chunk. If every request fails before a page is fetched, the run reports a failure rather than presenting an empty dataset as successful data.

For responsible use, crawl only public pages you are authorized to access, follow the target site's terms and robots policies, and avoid collecting personal or restricted information. The Actor is private during development and is not published automatically.

# Actor input Schema

## `startUrls` (type: `array`):

Public HTTP(S) pages to read. Use one URL for a page or several URLs for a crawl.

## `crawlLinks` (type: `boolean`):

Follow links on the same host as each start URL.

## `maxPages` (type: `integer`):

Maximum pages fetched across the run.

## `chunkSize` (type: `integer`):

Target maximum size of each returned chunk. Chunks prefer paragraph and sentence boundaries.

## `chunkOverlap` (type: `integer`):

Context repeated between adjacent chunks.

## `maxDepth` (type: `integer`):

Link depth from each start URL when crawling is enabled.

## `requestTimeoutSecs` (type: `integer`):

Timeout for an individual page request.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com"
    }
  ],
  "crawlLinks": false,
  "maxPages": 10,
  "chunkSize": 1200,
  "chunkOverlap": 150,
  "maxDepth": 2,
  "requestTimeoutSecs": 45
}
```

# Actor output Schema

## `status` (type: `string`):

No description

## `pagesFetched` (type: `string`):

No description

## `chunksReturned` (type: `string`):

No description

## `failedRequests` (type: `string`):

No description

## `warnings` (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("muhammadafzal/rag-web-browser").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("muhammadafzal/rag-web-browser").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 muhammadafzal/rag-web-browser --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/rag-web-browser"
        }
    }
}

```

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/IXkOtYasNIeoYGaly/builds/yuUSAd5LRdPFSrDe1/openapi.json
